我正在努力学习Angular,并买了一本书。不过,示例代码并未运行。我运行了Angular quickstart项目,但不是这个。也许有人能帮上忙。
这是我在运行npm start时得到的错误消息
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! blog-app@1.0.0 start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the blog-app@1.0.0 start script 'tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the blog-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs blog-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls blog-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! E:\angular\kickstart\blog-start\npm-debug.log这是我的package.json:
{
"name": "blog-app",
"version": "1.0.0",
"description": "Blog Applikation",
"watch": {
"copy:html": "./app/**/*.html"
},
"scripts": {
"start": "tsc && npm run copy:html && concurrently \"npm run tsc:w\" \"npm run html:watch\" \"live-server\" ",
"tsc": "./node_modules/.bin/tsc",
"tsc:w": "./node_modules/.bin/tsc --watch",
"copy:html": "copyfiles -u 1 ./app/**/*.html dist",
"html:watch": "onchange \"./app/**/*.html\" -v -- npm run copy:html"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@angular/common": ">=4.0.0-beta <5.0.0",
"@angular/compiler": ">=4.0.0-beta <5.0.0",
"@angular/core": ">=4.0.0-beta <5.0.0",
"@angular/forms": ">=4.0.0-beta <5.0.0",
"@angular/http": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser": ">=4.0.0-beta <5.0.0",
"@angular/platform-browser-dynamic": ">=4.0.0-beta <5.0.0",
"systemjs": "0.19.27",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.1.0",
"zone.js": "^0.8.4",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"canonical-path": "0.0.2",
"concurrently": "^2.2.0",
"copyfiles": "^1.0.0",
"http-server": "^0.9.0",
"live-server": "^1.1.0",
"lodash": "^4.11.1",
"npm-watch": "^0.1.6",
"onchange": "^3.0.2",
"rimraf": "^2.5.2",
"tslint": "^3.7.4",
"typescript": "^2.0.2",
"typings": "^1.0.4"
},
"repository": {}
}我尝试了Stackoverflow帖子中的一些解决方案(比如更改启动脚本,但没有帮助)。
编辑:已尝试更新NPM,但没有帮助:
PS E:\angular\kickstart\blog-start> npm start
> blog-app@1.0.0 start E:\angular\kickstart\blog-start
> tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server"
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
Type 'Observable<T>' is not assignable to type 'Observable<R>'.
Type 'T' is not assignable to type 'R'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! blog-app@1.0.0 start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the blog-app@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XYZ\AppData\Roaming\npm-cache\_logs\2017-10-26T10_14_42_254Z-debug.log日志文件:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\XYZ\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm@5.5.1
3 info using node@v6.11.5
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle blog-app@1.0.0~prestart: blog-app@1.0.0
6 info lifecycle blog-app@1.0.0~start: blog-app@1.0.0
7 verbose lifecycle blog-app@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle blog-app@1.0.0~start: PATH: C:\Users\XYZ\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;E:\angular\kickstart\blog-start\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\;C:\MinGW\bin;C:\Program Files\nodejs\;C:\Users\XYZ\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\XYZ\AppData\Local\Programs\Python\Python36-32\;C:\Users\XYZ\AppData\Local\Programs\Python\Launcher\;C:\Users\XYZ\AppData\Local\Microsoft\WindowsApps;;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files (x86)\CMake\bin;C:\Users\XYZ\AppData\Roaming\npm
9 verbose lifecycle blog-app@1.0.0~start: CWD: E:\angular\kickstart\blog-start
10 silly lifecycle blog-app@1.0.0~start: Args: [ '/d /s /c',
10 silly lifecycle 'tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" ' ]
11 silly lifecycle blog-app@1.0.0~start: Returned: code: 2 signal: null
12 info lifecycle blog-app@1.0.0~start: Failed to exec start script
13 verbose stack Error: blog-app@1.0.0 start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (C:\Users\XYZ\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\XYZ\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:920:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid blog-app@1.0.0
15 verbose cwd E:\angular\kickstart\blog-start
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\XYZ\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v6.11.5
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 2
22 error blog-app@1.0.0 start: `tsc && npm run copy:html && concurrently "npm run tsc:w" "npm run html:watch" "live-server" `
22 error Exit status 2
23 error Failed at the blog-app@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]发布于 2017-10-26 17:57:59
发布于 2017-10-26 18:02:14
它看起来像是与Angular CLI (npm ERR!argv "C:\Program Files\nodejs\node.exe“"C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js”“启动”),我在package.json文件中看不到它
我给你的建议是用Angular CLI创建一个新的干净项目,创建一些新的文件夹安装在那里Angular CLI -> npm Install @ angular /cli安装angular项目-> ng新的你的项目名
您可以随时尝试更新到最新版本的NodeJS,或者只在当前项目中安装Angular CLI,使用上述命令
https://stackoverflow.com/questions/46951254
复制相似问题