npm install不工作angular2

时间:2016-07-19 16:58:16

标签: angular npm-install



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 npm@2.11.3
3 info using node@v0.12.7
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!安装无法读取依赖项

我在桌面上创建了该文件夹。

1 个答案:

答案 0 :(得分:0)

因为您的根目录中没有 package.json 。要解决,请添加带有依赖项配置的 json,或尝试 npm init 从以下位置创建默认 package.json