角度2β“;npm运行tsc“;命令失败
我似乎无法使用角度2β“;npm运行tsc“;命令失败,npm,angular,tsc,Npm,Angular,Tsc,我似乎无法使用npm run ts命令编译我的Typescript。 我觉得有点奇怪的是,我可以运行npmstart,这样它就能编译并运行得很好 日志如下: 0 info it worked if it ends with ok 1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'tsc' ] 2 info using npm@2.11.3 3 info using node@v0.12.7 4 verbose run-script [ '
npm run ts
命令编译我的Typescript。
我觉得有点奇怪的是,我可以运行npmstart
,这样它就能编译并运行得很好
日志如下:
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'run', 'tsc' ]
2 info using npm@2.11.3
3 info using node@v0.12.7
4 verbose run-script [ 'pretsc', 'tsc', 'posttsc' ]
5 info pretsc MyProject@1.0.0
6 info tsc MyProject@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info MyProject@1.0.0 Failed to exec tsc script
9 verbose stack Error: MyProject@1.0.0 tsc: `tsc`
9 verbose stack Exit status 2
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid MyProject@1.0.0
11 verbose cwd /Users/kasperlaursen/adnexio.frontend
12 error Darwin 15.3.0
13 error argv "node" "/usr/local/bin/npm" "run" "tsc"
14 error node v0.12.7
15 error npm v2.11.3
16 error code ELIFECYCLE
17 error MyProject@1.0.0 tsc: `tsc`
17 error Exit status 2
18 error Failed at the MyProject@1.0.0 tsc script 'tsc'.
18 error This is most likely a problem with the MyProject package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error tsc
18 error You can get their info via:
18 error npm owner ls MyProject
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
PACKAGE.JSON:
{
"name": "MyProject",
"version": "1.0.0",
"scripts": {
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.3",
"systemjs": "0.19.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"zone.js": "0.5.11"
},
"devDependencies": {
"concurrently": "^1.0.0",
"lite-server": "^2.0.1",
"typescript": "^1.7.5"
}
}
您可能使用“npm安装”安装依赖项。这意味着它们不在路径中。这就是为什么直接使用tsc命令不起作用的原因 当使用“npm run start”时,我怀疑concurrent会使用node_modules文件夹中的诸如typescript(及其tsc命令)之类的库 类似“$(npm bin)”的东西在这样使用时会:
> $(npm bin)/tsc
有关更多详细信息,请参见此问题:
node\u modules/.bin/tsc
并发布结果,这样可以更容易地看到tsc
生成的错误以及它失败的原因。您可以试试$(npm-bin)/tsc运行两个您建议的命令时出现的错误。node_modules/angular2/src/facade/promise.d.ts(1,10):错误TS2661:无法重新导出模块中未定义的名称。
即使我出现错误,这似乎也会影响工作:node_modules/angular2/src/facade/promise.d.ts(1,10):错误TS2661:无法重新导出模块中未定义的名称。
> $(npm bin)/tsc