这是我的devDependencies:
"devDependencies": {
"@angular-devkit/architect": "^0.11.4",
"@angular-devkit/build-angular": "^0.901.12",
"@angular/cli": "~9.1.5",
"@angular/compiler": "^9.1.12",
"@angular/compiler-cli": "~9.1.6",
"@angular/language-service": "~9.1.6",
"@capacitor/cli": "2.4.0",
"@ionic/angular-toolkit": "^2.1.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.3",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3"
},
运行ionic serve
时出现错误消息
ionic serve
> ng run app:serve --host=localhost --port=8100
[ng] An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
[ng] Require stack:
[ng] - /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
[ng] - /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/index.js
[ng] - /usr/local/lib/node_modules/@angular/cli/models/architect-command.js
[ng] - /usr/local/lib/node_modules/@angular/cli/commands/run-impl.js
[ng] - /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/export-ref.js
[ng] - /usr/local/lib/node_modules/@angular/cli/node_modules/@angular-devkit/schematics/tools/index.js
[ng] - /usr/local/lib/node_modules/@angular/cli/utilities/json-schema.js
[ng] - /usr/local/lib/node_modules/@angular/cli/models/command-runner.js
[ng] - /usr/local/lib/node_modules/@angular/cli/lib/cli/index.js
[ng] - /usr/local/lib/node_modules/@angular/cli/lib/init.js
[ng] - /usr/local/lib/node_modules/@angular/cli/bin/ng
[ng] See "/private/var/folders/hq/z0xr0p_s07x7jj_m92h14pf40000gp/T/ng-Vv1038/angular-errors.log" for further details.
[ERROR] ng has unexpectedly closed (exit code 127).
The Ionic CLI will exit. Please check any output above for error details.
也获取此错误的调试日志:
926 verbose stack Error: Command failed: git checkout GH-1057-April-05-android-build-issue
926 verbose stack error: pathspec 'GH-1057-April-05-android-build-issue' did not match any file(s) known to git.
926 verbose stack
926 verbose stack at ChildProcess.exithandler (child_process.js:303:12)
926 verbose stack at ChildProcess.emit (events.js:315:20)
926 verbose stack at maybeClose (internal/child_process.js:1021:16)
926 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
927 verbose cwd /Library/WebServer/Documents/codebase/saloonwale-app
928 verbose Darwin 16.7.0
929 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
930 verbose node v12.18.3
931 verbose npm v6.14.7
932 error code 1
933 error Command failed: git checkout GH-1057-April-05-android-build-issue
933 error error: pathspec 'GH-1057-April-05-android-build-issue' did not match any file(s) known to git.
934 verbose exit [ 1, true ]
首先我得到devkit问题,它在npm install --save-dev @angular-devkit/build-angular
之后消失了,但是出现了新的错误: