我最初使用apt的nodejs
包(节点10(来运行Ionic 5应用程序,但看起来需要节点12或14。
所以我安装了带有npm的node --channel=12/stable
和ionic@5
。然后,只需将ionic start
与示例应用程序一起使用,ionic serve
就会崩溃:
$ 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
电容器也无法安装和添加android目标:
$ 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
试试这个:
npm install @ionic/app-scripts@latest --save-dev
在项目目录的根目录中。