当我尝试使用以下命令在cmd.exe
中启动我的angular 2项目时:npm start
我收到以下错误消息:
npm ERR! Windows_NT 10.0.15063
npm ERR! argv“D:\ NodeJs \ node.exe” “D:\ NodeJs \ node_modules \ npm \ bin \ npm-cli.js”“start”
npm ERR!节点v6.11.2
npm ERR! npm v3.10.10
npm ERR!代码ELIFECYCLE
npm ERR! angular-quickstart@1.0.0 prestart:
npm run build
npm ERR!退出状态1
npm ERR!
npm ERR!在angular-quickstart@1.0.0预启动脚本'npm失败 运行build'。
npm ERR!确保您拥有最新版本的node.js和npm 安装。
npm ERR!如果你这样做,这很可能是一个问题 angular-quickstart包,
npm ERR!不是与npm本身。
npm ERR!告诉作者你的系统失败了:
npm ERR! npm run build
npm ERR!您可以获取有关如何为此打开问题的信息 项目:
npm ERR! npm bugs angular-quickstart
npm ERR!或者,如果没有,您可以通过以下方式获取他们的信息:
npm ERR! npm owner ls angular-quickstart
npm ERR!上面可能有额外的日志记录输出。
npm ERR!请在支持请求中包含以下文件:
npm ERR! D:\ Angular 2 \ bon \ npm-debug.log“
我的package.json:“ “
name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~4.3.4",
"@angular/compiler": "~4.3.4",
"@angular/core": "~4.3.4",
"@angular/forms": "~4.3.4",
"@angular/http": "~4.3.4",
"@angular/platform-browser": "~4.3.4",
"@angular/platform-browser-dynamic": "~4.3.4",
"@angular/router": "~4.3.4",
"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "~2.1.0",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"@types/node": "^6.0.46",
"@types/jasmine": "2.5.36"
},
"repository": {}
}
"
我不知道问题是什么......
答案 0 :(得分:-1)
检查package.json中的启动脚本
"scripts": { "start": "ng serve" }
或直接使用 ng serve --o