Node.js/Windows 错误:ENOENT,stat 'C:\Users\RT\AppData\Roaming\npm'

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25093276/
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-02 17:44:02  来源:igfitidea点击:

Node.js/Windows error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm'

windowsnode.jsinstall

提问by tryasko

I have Windows 7 32-bit. I installed the latest Node.js32 bit.
When I try to run the command npm install jquery, I receive the error:

我有 Windows 7 32 位。我安装了最新的Node.js32 位。
当我尝试运行命令时npm install jquery,我收到错误:

Error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm

错误:ENOENT,stat 'C:\Users\RT\AppData\Roaming\npm

How does one resolve it?

一个人如何解决?

回答by Torsten

Manually creating a folder named 'npm' in the displayed path fixed the problem.

在显示的路径中手动创建一个名为“npm”的文件夹解决了这个问题。

More information can be found on Troubleshooting page

可以在故障排除页面上找到更多信息

回答by Aniket Thakur

I ran into the same problem while installing a package via npm.

我在通过 npm 安装软件包时遇到了同样的问题。

After creating the npmfolder manually in C:\Users\UserName\AppData\Roaming\that particular error was gone, but it gave similar multiple errors as it tried to create additional directories in the npmfolder and failed. The issue was resolved after running the command prompt as an administrator.

npmC:\Users\UserName\AppData\Roaming\该特定错误中手动创建文件夹后消失了,但是当它尝试在npm文件夹中创建其他目录并失败时,它给出了类似的多个错误。以管理员身份运行命令提示符后问题已解决。

回答by NStorm

This can also be fixed by installing a node package manually.

这也可以通过手动安装节点包来解决。

npm install npm -g

The process of doing that will setup all the required directories.

这样做的过程将设置所有必需的目录。

回答by Reece

I recommend setting an alternative location for your npm modules.

我建议为您的 npm 模块设置一个替代位置。

npm config set prefix C:\Dev\npm-repository\npm --global 
npm config set cache C:\Dev\npm-repository\npm-cache --global  

Of course you can set the location to wherever best suits.

当然,您可以将位置设置为最适合的位置。

This has worked well for me and gets around any permissions issues that you may encounter.

这对我来说效果很好,可以解决您可能遇到的任何权限问题。

回答by EliuX

You can go to the Start Menuand search the Node.js icon and open the shell and then install anything with

您可以转到“开始”菜单并搜索 Node.js 图标并打开外壳,然后使用

install <packagename> -g

回答by Sagar Awasthi

Install a stable version instead of the latest one, I have downgrade my version to node-v0.10.29-x86.msifrom 'node-v0.10.33-x86.msi'and it is working well for me!

安装一个稳定版本而不是最新版本,我已经将我的版本降级为node-v0.10.29-x86.msifrom 'node-v0.10.33-x86.msi',它对我来说运行良好!

http://blog.nodejs.org/2014/06/16/node-v0-10-29-stable/

http://blog.nodejs.org/2014/06/16/node-v0-10-29-stable/

回答by Helzgate

I needed a package from github that was written in typscript. I did a git pull of the most recent version from the master branch into the root of my main project. I then went into the directory and did an npm install so that the gulp commands would work that generates ES5 modules. Anyway, to make the long story short, my build process was trying to build files from this new folder so I had to move it out of my root. This was causing these same errors.

我需要来自 github 的一个用 typscript 编写的包。我从 master 分支将最新版本的 git pull git pull 到我的主项目的根目录中。然后我进入该目录并进行 npm install 以便 gulp 命令可以生成 ES5 模块。无论如何,长话短说,我的构建过程试图从这个新文件夹构建文件,所以我不得不将它移出我的根目录。这导致了这些相同的错误。