简体   繁体   English

npm install 什么都不做 - 如何让它工作?

[英]npm install does nothing - how make it work?

I have a trouble with npm and I haven't found solution in web.我在使用 npm 时遇到了麻烦,而且我还没有在 web.xml 中找到解决方案。

Today I wanted to start my adventure with nodejs, npm, bower etc.今天我想用 nodejs、npm、bower 等开始我的冒险。

I use Windows 8.1.我使用 Windows 8.1。

I installed the newest nodejs (v0.12.0).我安装了最新的 nodejs (v0.12.0)。 I tried these steps with both x64 and x86 builds.我在 x64 和 x86 版本中尝试了这些步骤。 I opened nodejs command line with administrative privileges.我用管理权限打开了 nodejs 命令行。 I updated npm to 2.5.0 version.我将 npm 更新到 2.5.0 版本。 When I run npm install bower -g I see a char that seems to show progress (it'is rolling) but nothing happens.当我运行npm install bower -g我看到一个似乎显示进度(正在滚动)但没有任何反应的字符。 Even if I leave it "working" for a 30 minutes, nothing happens.即使我让它“工作”了 30 分钟,也没有任何反应。 It never ends.永无止境。 When I type np ls -g it shows only npm@2.5.0 and it's dependencies.当我输入np ls -g它只显示 npm@2.5.0 及其依赖项。

I don't know what other info I could provide.我不知道我还能提供什么其他信息。 There are no errors nor logs.没有错误或日志。 Please, help.请帮忙。

Updated更新

Logs:日志:

npm info it worked if it ends with ok
npm verb cli [ 'node',
npm verb cli   'C:\\Users\\Lucek\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   '--verbose',
npm verb cli   'install',
npm verb cli   'bower',
npm verb cli   '-g' ]
npm info using npm@2.5.0
npm info using node@v0.12.0
npm verb cache add spec bower
npm verb addNamed bower@*
npm verb addNameRange registry:https://registry.npmjs.org/bower not in flight; fetching
npm verb request uri https://registry.npmjs.org/bower
npm verb request no auth needed
npm info attempt registry request try #1 at 08:43:01
npm verb request id 8d309c5e387572c0
npm verb etag "CQDT3LW680UJR78VNWVFLN8Q7"
npm http request GET https://registry.npmjs.org/bower
npm http 200 https://registry.npmjs.org/bower
npm verb get saving bower to C:\Users\Lucek\AppData\Roaming\npm-cache\registry.npmjs.org\bower\.cache.json
npm verb addNamed bower@1.3.12
npm verb addRemoteTarball https://registry.npmjs.org/bower/-/bower-1.3.12.tgz not in flight; adding
npm verb addRemoteTarball [ 'https://registry.npmjs.org/bower/-/bower-1.3.12.tgz',
npm verb addRemoteTarball   '37de0edb3904baf90aee13384a1a379a05ee214c' ]

Thetoast found solution that worked for me.Thetoast找到了对我有用的解决方案。

If you have the same problem check the value of your TEMP environment variable.如果您遇到同样的问题,请检查 TEMP 环境变量的值。 To do so run nodejs' command window and type为此,请运行 nodejs 的命令窗口并键入

echo %TEMP%

You should receive path to a single directory.您应该收到单个目录的路径。 If you receive multiple directory (as I did - I received C:\\Users\\<user>\\AppData\\Local\\Temp;c:\\Users\\<user>\\AppData\\Local\\Atlassian\\SourceTree\\git_local\\bin\\ ) it means that this might by the cause of the problem.如果您收到多个目录(就像我一样 - 我收到C:\\Users\\<user>\\AppData\\Local\\Temp;c:\\Users\\<user>\\AppData\\Local\\Atlassian\\SourceTree\\git_local\\bin\\ )它意味着这可能是问题的原因。 You can fix it by typing您可以通过键入来修复它

SET TEMP=<correct path to temporary directory>

where <correct path to temporary directory> might by the first path (before semicolon, that means C:\\Users\\<user>\\AppData\\Local\\Temp in my case).其中<correct path to temporary directory>可能是第一个路径(在分号之前,这意味着C:\\Users\\<user>\\AppData\\Local\\Temp在我的情况下)。

I had some issues with the npm install bower -g aswell but try this command:我也遇到了npm install bower -g一些问题,但试试这个命令:

npm install bower --global

this one worked for me这个对我有用

I know this is an old question but i am adding this answer just for the record.我知道这是一个老问题,但我添加这个答案只是为了记录。

I was facing a similar issue ie rotating character with no progress in actual installation after trying to install using the following command on linux Mint 17(from http://bower.io/#install-bower ):在尝试在 linux Mint 17(来自http://bower.io/#install-bower )上使用以下命令进行安装后,我遇到了类似的问题,即在实际安装中没有任何进展的旋转字符:

npm install -g bower

The command which actually worked for me is:实际上对我有用的命令是:

npm install --global bower

Note: You will need root/administrative privelage to run this command.注意:您将需要 root/administrative privelage 才能运行此命令。 So you might wanna use sudo.所以你可能想使用 sudo。

I was getting the same error.我遇到了同样的错误。 But I found that this was Windows Firewall problem.但我发现这是 Windows 防火墙问题。

Make sure your firewall is not preventing any Incoming connections or there is no limit on TCP connections.确保您的防火墙没有阻止任何传入连接或 TCP 连接没有限制。

如果对某人有帮助,只需添加另一个解决方案 - 我在克隆 repo 后遇到了这个问题,发现吹走node_modules对我node_modules

rm -rf node_modules

For me, this problem was caused by Controlled Folder Access in Windows Virus and Thread Protection > Ransomware Protection > Controlled Folder Access.对我来说,这个问题是由 Windows 病毒和线程保护 > 勒索软件保护 > 受控文件夹访问中的受控文件夹访问引起的。

Windows 勒索软件防护

Turning this off fixed the problem.关闭它可以解决问题。

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

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