Error when running ionic serve

Hi, i have a problem when running the ionic serve command

The error that shows me the ionic serve command was:

$ ionic serve
Error: spawn EPERM

    at ChildProcess.spawn (internal/child_process.js:366:11)
    at Object.spawn (child_process.js:538:9)
    at spawn 
(/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:12:24)
    at spawn 
(/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:173:12)
    at Subprocess.spawn 
(/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:146:16)
    at Shell.<anonymous> (/usr/local/lib/node_modules/ionic/lib/shell.js:162:27)
    at Generator.next (<anonymous>)
    at fulfilled 
(/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:104:62)

My ionic serve --verbose output is:

ionic serve --verbose
  ionic:lib Terminal info: { tty: true, ci: false, windows: false } +0ms
  ionic:lib CLI global options: { _: [ 'serve' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +4ms
  ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
  ionic:lib:project Project details: { configPath: '/Users/amador/Documents/pantoapp/ionic.config.json', errors: [], context: 'app', type: 'angular' } +1ms
  ionic Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/Users/amador/Documents/pantoapp', version: '4.12.0' } +0ms
  ionic:lib:telemetry Sending telemetry for command: 'ionic serve' [ '--verbose', '--interactive', '--color' ] +0ms
  ionic:lib:hooks Looking for ionic:serve:before npm script. +0ms
  ionic:utils-network checking for open port on 0.0.0.0:8100 +0ms
  ionic:utils-network checking for open port on ::1:8100 +18ms
  ionic:utils-network checking for open port on 127.0.0.1:8100 +3ms
  ionic:utils-network checking for open port on fe80::1:8100 +0ms
  ionic:utils-network error while checking fe80::1:8100: { Error: listen EADDRNOTAVAIL: address not available fe80::1:8100 at Server.setupListenHandle [as _listen2] (net.js:1253:19) at listenInCluster (net.js:1318:12) at doListen (net.js:1451:7) at process._tickCallback (internal/process/next_tick.js:63:19) code: 'EADDRNOTAVAIL', errno: 'EADDRNOTAVAIL', syscall: 'listen', address: 'fe80::1', port: 8100 } +1ms
  ionic:utils-network checking for open port on fe80::ca69:cdff:fe98:8560:8100 +1ms
  ionic:utils-network error while checking fe80::ca69:cdff:fe98:8560:8100: { Error: listen EADDRNOTAVAIL: address not available fe80::ca69:cdff:fe98:8560:8100 at Server.setupListenHandle [as _listen2] (net.js:1253:19) at listenInCluster (net.js:1318:12) at doListen (net.js:1451:7) at process._tickCallback (internal/process/next_tick.js:63:19) code: 'EADDRNOTAVAIL', errno: 'EADDRNOTAVAIL', syscall: 'listen', address: 'fe80::ca69:cdff:fe98:8560', port: 8100 } +0ms
  ionic:utils-network checking for open port on 192.168.10.8:8100 +1ms
  ionic:utils-network checking for open port on 2803:b780:17:254:ca69:cdff:fe98:8560:8100 +0ms
  ionic:utils-network checking for open port on 2803:b780:17:254:982e:ca2d:2d17:8340:8100 +1ms
  ionic:utils-network checking for open port on fe80::60cd:adff:fed4:9464:8100 +0ms
  ionic:utils-network error while checking fe80::60cd:adff:fed4:9464:8100: { Error: listen EADDRNOTAVAIL: address not available fe80::60cd:adff:fed4:9464:8100 at Server.setupListenHandle [as _listen2] (net.js:1253:19) at listenInCluster (net.js:1318:12) at doListen (net.js:1451:7) at process._tickCallback (internal/process/next_tick.js:63:19) code: 'EADDRNOTAVAIL', errno: 'EADDRNOTAVAIL', syscall: 'listen', address: 'fe80::60cd:adff:fed4:9464', port: 8100 } +0ms
  ionic:lib:serve Looking for ionic:serve npm script. +0ms
Error: spawn EPERM

    at ChildProcess.spawn (internal/child_process.js:366:11)
    at Object.spawn (child_process.js:538:9)
    at spawn 
(/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:12:24)
    at spawn 
(/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:173:12)
    at Subprocess.spawn 
(/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:146:16)
    at Shell.<anonymous> (/usr/local/lib/node_modules/ionic/lib/shell.js:162:27)
    at Generator.next (<anonymous>)
    at fulfilled 
(/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:104:62)
  ionic Error: spawn EPERM
  ionic     at ChildProcess.spawn (internal/child_process.js:366:11)
  ionic     at Object.spawn (child_process.js:538:9)
  ionic     at spawn (/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:12:24)
  ionic     at spawn (/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:173:12)
  ionic     at Subprocess.spawn (/usr/local/lib/node_modules/ionic/node_modules/@ionic/utils-subprocess/dist/index.js:146:16)
  ionic     at Shell.<anonymous> (/usr/local/lib/node_modules/ionic/lib/shell.js:162:27)
  ionic     at Generator.next (<anonymous>)
  ionic     at fulfilled (/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:104:62) +149ms

The ionic info output:

$ ionic info
[WARN] You are not in an Ionic project directory. Project context may be 
       missing.

Ionic:

   ionic (Ionic CLI) : 4.12.0

System:

   NodeJS : v10.15.3
   npm    : 6.9.0
   OS     : OS X Yosemite

I hope you can help me!

Verify that your active directory in your terminal is in fact the top level of your ionic project. If you run ls in the terminal you should see:
angular.json package-lock.json tslint.json
e2e package.json typings
ionic.config.json src
node_modules tsconfig.json

I run ls on the /path-app in the terminal, the output is:

$ ls
README.md		node_modules		src
angular.json		package-lock.json	tsconfig.json
config.xml		package.json		tslint.json
e2e			plugins			www
ionic.config.json	resources

Did you fix that? I am facing the same issue (same Ionic CLI and NodeJS version, but on Windows 2012). Everything was working fine, and after installing @ionic-native/screen-orientation plugin, I started having this issue. I know this may sound weird, but this was the only thing I changed in my environment.

After that, I uninstalled ionic, cli, node, etc, cleaned up cache, restarted the machine a bunch of times, but cannot make this work again.

Thanks

1 Like

Any updates on solution to fix this problem?

  1. ionic cordova platform rm android
  2. ionic cordova platform add android
  3. delete folder node_modules
  4. npm install