2016-07-19 221 views
1

NPM安裝不工作angular2

tsconfig.jsonfile: 
 

 
{ 
 
    "compilerOptions": { 
 
    "target": "es5", 
 
    "module": "commonjs", 
 
    "moduleResolution": "node", 
 
    "sourceMap": true, 
 
    "emitDecoratorMetadata": true, 
 
    "experimentalDecorators": true, 
 
    "removeComments": false, 
 
    "noImplicitAny": true, 
 
    "suppressImplicitAnyIndexErrors": true 
 
    } 
 
} 
 

 

 
npm-debug.log file 
 
0 info it worked if it ends with ok 
 
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install' ] 
 
2 info using [email protected] 
 
3 info using [email protected] 
 
4 verbose readDependencies loading dependencies from /Users/sxc103/Desktop/angular2/package.json 
 
5 error install Couldn't read dependencies 
 
6 verbose stack Error: ENOENT, open '/Users/sxc103/Desktop/angular2/package.json' 
 
6 verbose stack  at Error (native) 
 
7 verbose cwd /Users/sxc103/Desktop/angular2 
 
8 error Darwin 15.2.0 
 
9 error argv "node" "/usr/local/bin/npm" "install" 
 
10 error node v0.12.7 
 
11 error npm v2.11.3 
 
12 error path /Users/sxc103/Desktop/angular2/package.json 
 
13 error code ENOPACKAGEJSON 
 
14 error errno -2 
 
15 error package.json ENOENT, open '/Users/sxc103/Desktop/angular2/package.json' 
 
15 error package.json This is most likely not a problem with npm itself. 
 
15 error package.json npm can't find a package.json file in your current directory. 
 
16 verbose exit [ -2, true ]

試圖玩弄angular2快速啓動。當我在同一個文件夾中運行npm install時顯示錯誤:

npm ERR! install Couldn't read dependencies

我在桌面上創建了該文件夾。

+0

您是否完成了步驟1.b(即創建所有這些文件)? –

+0

您可以在這裏參考示例package.json - https://angular.io/docs/ts/latest/quickstart.html#!#add-config-files – Sanket

回答

0

這是因爲你沒有package.json在你的根目錄下。爲了解決添加 JSON具有依賴性的配置或嘗試NPM初始化創建默認的package.json劃傷