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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28384040/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:57:59  来源:igfitidea点击:

npm install does nothing - how make it work?

windowsnpmbower

提问by Lucenty

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). I tried these steps with both x64 and x86 builds. I opened nodejs command line with administrative privileges. I updated npm to 2.5.0 version. When I run npm install bower -gI see a char that seems to show progress (it'is rolling) but nothing happens. Even if I leave it "working" for a 30 minutes, nothing happens. It never ends. When I type np ls -git shows only [email protected] and it's dependencies.

我安装了最新的 nodejs (v0.12.0)。我在 x64 和 x86 版本中尝试了这些步骤。我用管理权限打开了 nodejs 命令行。我将 npm 更新到 2.5.0 版本。当我运行时,npm install bower -g我看到一个似乎显示进度(正在滚动)但没有任何反应的字符。即使我让它“工作”了 30 分钟,也没有任何反应。永无止境。当我输入时,np ls -g它只显示 [email protected] 和它的依赖项。

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 [email protected]
npm info using [email protected]
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 [email protected]
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' ]

回答by Lucenty

Thetoastfound solution that worked for me.

Thetoast找到了对我有用的解决方案。

If you have the same problem check the value of your TEMP environment variable. To do so run nodejs' command window and type

如果您遇到同样的问题,请检查 TEMP 环境变量的值。为此,请运行 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. You can fix it by typing

您应该收到单个目录的路径。如果您收到多个目录(如我所做的 - 我收到C:\Users\<user>\AppData\Local\Temp;c:\Users\<user>\AppData\Local\Atlassian\SourceTree\git_local\bin\),则意味着这可能是问题的原因。您可以通过键入来修复它

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\Tempin my case).

<correct path to temporary directory>第一条路径可能在哪里(在分号之前,这意味着C:\Users\<user>\AppData\Local\Temp在我的情况下)。

回答by YvesHendseth

I had some issues with the npm install bower -gaswell but try this command:

我也有一些问题,npm install bower -g但试试这个命令:

npm install bower --global

this one worked for me

这个对我有用

回答by Max

I know this is an old question but i am adding this answer just for the record.

我知道这是一个老问题,但我添加这个答案只是为了记录。

I was facing a similar issue i.e. 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. So you might wanna use sudo.

注意:您将需要 root/administrative privelage 才能运行此命令。所以你可能想使用 sudo。

回答by Raj Shah

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 连接没有限制。

回答by MeltingDog

Just adding another solution if it helps someone - I had this issue after cloning a repo and found blowing away node_modulesworked for me.

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

rm -rf node_modules