npm install <package>无法正常工作

时间:2017-01-11 06:30:08

标签: angularjs node.js command-line npm

我正在尝试按照教程在我的项目中安装角度包。

我的系统中已经安装了npm(4.0.5)和节点(6.9.2)

我在项目文件夹中运行:

 npm install angular

但是我的项目目录中没有安装node_modules文件夹。我已尝试过此命令,但仍无法正常工作:

sudo chown -R $(whoami) ~/.npm

我运行npm install angular时遇到的错误:

├── angular@1.6.1 
├── UNMET PEER DEPENDENCY es6-shim@^0.35.0
├── UNMET PEER DEPENDENCY reflect-metadata@0.1.2
├── UNMET PEER DEPENDENCY rxjs@5.0.0-beta.6
└── UNMET PEER DEPENDENCY zone.js@^0.6.12

npm WARN enoent ENOENT: no such file or directory, open  '/Users/nilliany/package.json'
npm WARN angular2@2.0.0-beta.21 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN angular2@2.0.0-beta.21 requires a peer of reflect-metadata@0.1.2 but none was installed.
npm WARN angular2@2.0.0-beta.21 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm WARN angular2@2.0.0-beta.21 requires a peer of zone.js@^0.6.12 but none was installed.
npm WARN nilliany No description
npm WARN nilliany No repository field.
npm WARN nilliany No README data
npm WARN nilliany No license field.

1 个答案:

答案 0 :(得分:0)

你的项目中应该有一个package.json来进行npm install。请从项目中执行npm init并按照说明操作。它将在您的项目中创建一个package.json文件。稍后您可以在项目中安装任何节点包。