简体   繁体   English

命令“ npm install”不起作用

[英]Command “npm install” not work

When I direct to folder what I clone AngularJs by Git and try to use the command "npm install". 当我将文件夹定向到我通过Git克隆AngularJs并尝试使用命令“ npm install”时。 Then, It always show the info below. 然后,它总是显示下面的信息。 I'm sure that I have package.json and cd to the folder. 我确定文件夹中有package.json和cd。

Here is enviroment of mine: 这是我的环境:

  • OS Win7 操作系统Win7
  • Node.js version v5.3.0 Node.js版本v5.3.0
  • npm version v3.3.12 npm版本v3.3.12

Error Message: 错误信息:

events.js:141
throw er; // Unhandled 'error' event<
     ^

Error: This socket is closed.<br>
    at WriteStream.Socket._writeGeneric (net.js:640:19)<br>
    at WriteStream.Socket._write (net.js:694:8)<br>
    at doWrite (_stream_writable.js:292:12)<br>
    at writeOrBuffer (_stream_writable.js:278:5)<br>
    at WriteStream.Writable.write (_stream_writable.js:207:11)<br>
    at WriteStream.Socket.write (net.js:618:40)<br>
at WriteStream.stream.write (C:\ProgramFiles\nodejs\node_modules\npm\
node_modules\npmlog\node_modules\ansi\lib\newlines.js:36:21)<br>

at Cursor.write (C:\ProgramFiles\nodejs\node_modules\npm\
node_modules\npmlog\node_modules\ansi\lib\ansi.js:157:23)<br>

at Cursor.(anonymous function) [as show] (C:\Program Files\nodejs\
node_modules\npm\node_modules\npmlog\node_modules\ansi\lib\ansi.js:226:26)<br>

at Object.ProgressBar.hide (C:\Program Files\nodejs\node_modules\npm\
node_modules\npmlog\node_modules\gauge\progress-bar.js:101:15)<br>

You need to go to your node folder where you installed it. 您需要转到安装它的节点文件夹。 Then go to your node folder and run below command to get bundle certificate. 然后转到您的节点文件夹并运行以下命令以获取捆绑包证书。

~node > git config --system http.sslcainfo /bin/curl-ca-bundle.crt
~node > git clone --recursive git://github.com/isaacs/npm.git
~node > cd npm
~npm > node cli.js install npm -gf
~npm > npm install express -g

Git will not run in windows so you can install gitbash or any other git tool. Git不会在Windows中运行,因此您可以安装gitbash或任何其他git工具。

I hope it will help. 希望对您有所帮助。

I have used above codes with Git Bash (run as administrator) its working for me also. 我已经将上述代码与Git Bash(以管理员身份运行)一起使用,它对我来说也有效。 Thanks 谢谢

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

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