'Ionic 5.4.16 fails to run with node 12.19.0 @ Ubuntu 20.04
I initially used apt's nodejs package (node 10) to run an Ionic 5 app but it looks like node 12 or 14 are needed.
So I've then installed node --channel=12/stable then ionic@5 with npm.
Then just by using ionic start with an example app and yet ionic serve crashes:
$ ionic serve --verbose
ionic:lib Terminal info: { ci: false, shell: '/bin/bash', tty: true, 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, '--': [] } +3ms
ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
ionic:lib:project Project details: { configPath: '/home/courrier/Repos/test/test/ionic.config.json', errors: [], context: 'app', type: 'angular' } +0ms
ionic Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/home/courrier/Repos/test/test', version: '5.4.16' } +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 127.0.0.1:8100 +2ms
ionic:utils-network checking for open port on 192.168.1.92:8100 +1ms
ionic:utils-network checking for open port on fe80::f4f8:10cd:17fd:94d0:8100 +0ms
ionic:utils-network error while checking fe80::f4f8:10cd:17fd:94d0:8100: Error: listen EINVAL: invalid argument fe80::f4f8:10cd:17fd:94d0:8100 at Server.setupListenHandle [as _listen2] (net.js:1300:21) at listenInCluster (net.js:1365:12) at doListen (net.js:1502:7) at processTicksAndRejections (internal/process/task_queues.js:85:21) { code: 'EINVAL', errno: 'EINVAL', syscall: 'listen', address: 'fe80::f4f8:10cd:17fd:94d0', port: 8100 } +0ms
ionic:lib:serve Looking for ionic:serve npm script. +8ms
> ng run app:serve --host=localhost --port=8100 --verbose
ionic:lib:serve received unexpected close for ng (code: 127) +378ms
[ERROR] ng has unexpectedly closed (exit code 127).
The Ionic CLI will exit. Please check any output above for error details.
ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 1 functions +0ms
ionic:utils-process processExit: exiting (exit code: 1) +11ms
Capacitor also fails to install and add an android target:
$ ionic cap add android --verbose
ionic:lib Terminal info: { ci: false, shell: '/bin/bash', tty: true, windows: false } +0ms
ionic:lib CLI global options: { _: [ 'cap', 'add', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +3ms
ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
ionic:lib:project Project details: { configPath: '/home/courrier/Repos/test/test/ionic.config.json', errors: [], context: 'app', type: 'angular' } +0ms
ionic Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/home/courrier/Repos/test/test', version: '5.4.16' } +0ms
> ionic integrations enable capacitor
> npm i --save -E @capacitor/core
ionic:lib:telemetry Sending telemetry for command: 'ionic integrations enable' [ 'capacitor', '--interactive', '--color' ] +0ms
[ERROR] An error occurred while running subprocess npm.
npm i --save -E @capacitor/core exited with exit code 243.
Re-running this command with the --verbose flag may provide more information.
ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 1 functions +0ms
ionic:utils-process processExit: exiting (exit code: 1) +10ms
Solution 1:[1]
try this:
npm install @ionic/app-scripts@latest --save-dev
in the root of the project directory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Agung Sudrajat Supriatna |
