简体   繁体   English

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

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

I have Windows 7 32-bit.我有 Windows 7 32 位。 I installed the latest Node.js 32 bit.我安装了最新的Node.js 32 位。
When I try to run the command npm install jquery , I receive the error:当我尝试运行命令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?一个人如何解决?

Manually creating a folder named 'npm' in the displayed path fixed the problem.在显示的路径中手动创建一个名为“npm”的文件夹解决了这个问题。

More information can be found on Troubleshooting page可以在故障排除页面上找到更多信息

I ran into the same problem while installing a package via npm.我在通过 npm 安装软件包时遇到了同样的问题。

After creating the npm folder 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 npm folder and failed.C:\\Users\\UserName\\AppData\\Roaming\\中手动创建npm文件夹后,该特定错误消失了,但它在尝试在npm文件夹中创建其他目录并失败时出现了类似的多个错误。 The issue was resolved after running the command prompt as an administrator .以管理员身份运行命令提示符后问题已解决。

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.这样做的过程将设置所有必需的目录。

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.这对我来说效果很好,可以解决您可能遇到的任何权限问题。

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

install <packagename> -g

Install a stable version instead of the latest one, I have downgrade my version to node-v0.10.29-x86.msi from 'node-v0.10.33-x86.msi' and it is working well for me!安装稳定版本而不是最新版本,我已将我的版本从'node-v0.10.33-x86.msi'降级到node-v0.10.29-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/

I needed a package from github that was written in typscript.我需要来自 github 的一个用 typscript 编写的包。 I did a git pull of the most recent version from the master branch into the root of my main project.我从 master 分支将最新版本的 git pull git pull 到我的主项目的根目录中。 I then went into the directory and did an npm install so that the gulp commands would work that generates ES5 modules.然后我进入该目录并进行 npm install 以便 gulp 命令可以生成 ES5 模块。 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.这导致了这些相同的错误。

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

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