简体   繁体   English

npm 安装失败并出现错误

[英]npm install fails with error

I'm following this tutorial enter link description here but I'v got stuck at 12:41.我正在关注本教程,在此处输入链接描述,但我在 12:41 卡住了。 I downloaded seed project following link in the video description and issued somman npm install as administrator on Windows 7. But I'm getting following error:我通过视频说明中的链接下载了种子项目,并在 Windows 7 上以管理员身份发布了 somman npm install 。但是我收到以下错误:

C:\development\angular2\angular2-seed>npm install

> angular2-quickstart@1.0.0 postinstall C:\development\angular2\angular2-seed
> typings install

(I translated following lines to English)
typings is not name of an command, executable or batch.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\ch
okidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.0.14: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"
})
npm WARN angular2-quickstart@1.0.0 No description
npm WARN angular2-quickstart@1.0.0 No repository field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Administrator\\A
ppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.6.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-quickstart@1.0.0 postinstall script 'typings ins
tall'.
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 angular2-quickstart p
ackage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\development\angular2\angular2-seed\npm-debug.log

Please advise.请指教。 Thank you.谢谢。

EDIT: Attached file npm-debug.log: enter link description here Attached file package.json: enter link description here编辑:附件 npm-debug.log:在此处输入链接描述附件 package.json:在此处输入链接描述

Permission Issue .权限问题 It probably has to do with the path names in windows.它可能与 Windows 中的路径名有关。

Check the same in Git Bash or Windows Powershell.在 Git Bash 或 Windows Powershell 中检查相同的内容。

You can set the NODE path like : set NODE_PATH=source您可以设置节点路径,如: set NODE_PATH=source

Remove the node_modules and run npm install again.删除 node_modules 并再次运行npm install

If someone is in my situation facing this error and have tried all the solutions mentioned here, and another similar question, like:如果有人在我的情况下面临这个错误并尝试了这里提到的所有解决方案,以及另一个类似的问题,例如:

  • you are in the right directory你在正确的目录中

  • you have a package.json file,你有一个 package.json 文件,

  • the JSON is valid, JSON 有效,

  • you have tried to run %temp%你试过运行 %temp%

  • you have tried " npm install -d --save" etc.您已经尝试过“npm install -d --save”等。

Mine worked by doing "npm install --force"我的工作是做“npm install --force”

Note: This was also recommended in the error itself, which I didn't pay attention to earlier.注意:这个错误本身也是推荐的,之前没注意。

Even " Yarn install" worked.甚至“纱线安装”也有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM