npm 安装在 Windows 中不起作用 [英] npm install not working in windows

查看:93
本文介绍了npm 安装在 Windows 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这里发生了什么.希望有人能帮助我.

I have no idea what is happening here. Hoping someone can help me.

这在我的 Mac 上运行良好.但是 Windows 和 npm install 中的相同过程崩溃了.这就是我得到的.

This works great in my mac. But same process in Windows and npm install crashes. This is what I get.

编辑

到目前为止,我已经尝试了我在 SO 中看到的所有内容以及 Google 搜索生成的每个链接.我按照此处的建议尝试了以下操作:

I've tried everything I've seen in SO so far and every link Google search produced. I tried the following as suggested here:

rm -rf node_modules
npm install

没用

以管理员身份运行,

试过 npm install -g

tried npm install -g

重启xampp服务器

关闭 Windows Defender

turned off Windows defender

检查 C:\Program Files\nodejs 的 PATH

checked the PATH for C:\Program Files\nodejs

差点扔掉这个 POS Windows 扔了一个窗口,双关语,我已经做了所有的事情.苹果万岁!

Short of throwing this POS Windows threw a window, pun intended, I've done everything. Hail Apple!

warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   win32
verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
warn fuse@1.4.4 No description
verbose If you need help, you may report this error at:
verbose     <https://github.com/npm/npm/issues>
warn fuse@1.4.4 No repository field.
verbose If you need help, you may report this error at:
verbose     <https://github.com/npm/npm/issues>
warn fuse@1.4.4 No license field.
verbose If you need help, you may report this error at:
verbose     <https://github.com/npm/npm/issues>
verbose stack Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
verbose stack     at destStatted (C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
verbose stack     at C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:276:29
verbose stack     at FSReqWrap.oncomplete (fs.js:123:15)
verbose stack
verbose stack Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
verbose stack     at Error (native)
verbose cwd C:\xampp\htdocs\ScalaCM
error Windows_NT 10.0.14393
error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Luis\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
error node v6.9.1
error npm  v4.0.2
error path C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290
error code EPERM
error errno -4048
error syscall rename
error Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at destStatted (C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
error     at C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:276:29
error     at FSReqWrap.oncomplete (fs.js:123:15)
error
error Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at Error (native)
error  { Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at destStatted (C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
error     at C:\Users\Luis\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:276:29
error     at FSReqWrap.oncomplete (fs.js:123:15)
error
error Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\ScalaCM\node_modules\.staging\accessibility-developer-tools-2e33f290' -> 'C:\xampp\htdocs\ScalaCM\node_modules\accessibility-developer-tools'
error     at Error (native) parent: 'fuse' }
error Please try running this command again as root/Administrator.
verbose exit [ -4048, true ]

node -v 给我一个版本 v6.9.1

node -v gives me a version v6.9.1

npm -v 也给了我一个 4.0.2 的版本

npm -v gives me a version as well 4.0.2

这证明它们都安装得很好,对吗?

Which proves they are all installed fine, am I right?

推荐答案

经过无数小时的调试和研究,我决定在另一台机器上安装,看看问题是否出在我的 Node 安装上.有效.

After countless hours of debugging and researching, I decided to install in a different machine to see if the problem was with my Node installation. It worked.

因此对于可能遇到此问题的每个人,都知道卸载节点和删除 NPM 的可能性将存在.这就是我所做的.我相信这是解决问题的最安全方法,并且您机器中安装的所有其他应用程序仍然可以工作.我将这些步骤归功于 这个答案,尽管我还有其他其他位置的 npm 和 node_modules.因此,请快速搜索这些内容,除非它们是应用程序的一部分,否则请确保它们也被删除.

So for everyone who may come across this, know that the possibility to uninstall node and delete NPM will be there. This is what I did. I believe it is the safest way to solve the problem and all the rest of your applications installed in your machine will still work. I credit this answer for these steps, although I had other npm and node_modules in other locations. So do a quick search for these and unless they are part of an application, make sure they are deleted as well.

  1. 从程序中卸载 &卸载程序的功能.

  1. Uninstall from Programs & Features with the uninstaller.

重新启动(或者您可能可以从任务管理器中杀死所有与节点相关的进程).

Reboot (or you probably can get away with killing all node-related processes from Task Manager).

查找这些文件夹并删除它们(及其内容)(如果仍然存在).根据您安装的版本、UAC 设置和 CPU 架构,这些可能存在也可能不存在:

Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:

  • C:\Program Files (x86)\Nodejs
  • C:\Program Files\Nodejs
  • C:\Users\{User}\AppData\Roaming\npm(或 %appdata%\npm)
  • C:\Users\{User}\AppData\Roaming\npm-cache(或 %appdata%\npm-cache)
  • C:\Users\{User}\.npmrc(也可能检查没有 . 前缀)
  • C:\Program Files (x86)\Nodejs
  • C:\Program Files\Nodejs
  • C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
  • C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
  • C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)

检查您的%PATH% 环境变量,以确保不存在对 Nodejsnpm 的引用.

Check your %PATH% environment variable to ensure no references to Nodejs or npm exist.

如果它仍然没有卸载,在命令提示符下输入where node,你会看到它所在的位置——删除它(可能还有父节点)目录).

If it's still not uninstalled, type where node at the command prompt and you'll see where it resides -- delete that (and probably the parent directory) too.

重新启动,很好.

这篇关于npm 安装在 Windows 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆