I'm trying to install npm package (node-xmpp-server) but it fail to install. previously when I'm trying to install a package that is install globally instead of locally, but now it's not installing at all.
Plz Help me.
我正在尝试安装npm软件包(node-xmpp-server),但无法安装。以前当我尝试安装全局安装而不是本地安装的软件包时,现在它根本就没有安装。 Plz帮助我。
npm install node-xmpp-server
error is: npm ERR! errno -4048
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\Program Files\nodejs\node.exe" "c:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "node-xmpp-server"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path c:\Users\Jaseem Abbas\Documents\node_modules\node- xmpp-server\examples
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples' } npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EPERM, unlink 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EPERM, unlink 'c:\Users\Jaseem
Abbas\Documents\node_modules\node-xmpp-server\examples']
npm ERR! error rolling back errno: -4048,
npm ERR! error rolling back code: 'EPERM',
npm ERR! error rolling back path: 'c:\Users\Jaseem Abbas\Documents\node_modules\node-xmpp-server\examples' }npm install node-xmpp-server错误是:npm ERR! errno -4048 npm ERR! Windows_NT 6.3.9600 npm ERR! argv“c:\ Program Files \ nodejs \ node.exe”“c:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js”“install”“node-xmpp-server”npm ERR!节点v0.12.4 npm ERR! npm v2.10.1 npm ERR!路径c:\ Users \ Jaseem Abbas \ Documents \ node_modules \ node-xmpp-server \ examples npm ERR!代码EPERM npm ERR! errno -4048 npm ERR!错误:EPERM,取消链接'c:\ Users \ Jaseem Abbas \ Documents \ node_modules \ node-xmpp-server \ examples'npm ERR!在错误(本机)npm ERR! {[错误:EPERM,unlink'c:\ Users \ Jaseem Abbas \ Documents \ node_modules \ node-xmpp-server \ examples'] npm ERR!错误:-4048,npm ERR!代码:'EPERM',npm ERR!路径:'c:\ Users \ Jaseem Abbas \ Documents \ node_modules \ node-xmpp-server \ examples'} npm ERR!错误的ERR!请尝试以root / Administrator身份再次运行此命令。错误的ERR!错误回滚错误:EPERM,unlink'c:\ Users \ Jaseem Abbas \ Documents \ node_modules \ node-xmpp-server \ examples'npm ERR!错误回滚错误(本机)npm ERR!错误回滚{[错误:EPERM,unlink'c:\ Users \ Jaseem Abbas \ Documents \ node_modules \ node-xmpp-server \ examples'] npm ERR!错误回滚错误:-4048,npm ERR!错误回滚代码:'EPERM',npm ERR!错误回滚路径:'c:\ Users \ Jaseem Abbas \ Documents \ node_modules \ node-xmpp-server \ examples'}
17 个解决方案
#1
48
Kill whatever process is locking your files
It seems like this kind of error can be caused by a file permissions lock - I experienced something very similar (the same ERRNO: -4048) when installing whatwg-fetch
.
似乎这种错误可能是由文件权限锁定引起的 - 我在安装whatwg-fetch时经历了非常相似的事情(相同的ERRNO:-4048)。
I found that a Visual Studio instance I had open at the same time was acquiring all kinds of files which it didn't need. Once I closed that down, the install worked perfectly.
我发现我同时打开的Visual Studio实例正在获取它不需要的各种文件。一旦我关闭它,安装工作完美。
This may be a quickly-checked possible cause to eliminate before moving on to more drastic measures...
这可能是一个快速检查的可能原因,在采取更激烈的措施之前消除...
#2
14
if you still have troubles with this error and maybe you upgrade the node version to 5.4 > ... that version presents an error. here the solution that basically consist in downgrade node version
如果您仍然遇到此错误的麻烦,并且可能将节点版本升级到5.4> ...该版本出现错误。这里的解决方案基本上包括降级节点版本
In Windows will be:
在Windows中将是:
npm install -g npm@5.3
That's works for me.
这对我有用。
#3
9
I was having the same problem and I found the following solution:
我遇到了同样的问题,我找到了以下解决方案:
-
remove both of
删除两者
- %ProgramFiles%\nodejs\npm
- 的%ProgramFiles%\的NodeJS \ NPM
- %ProgramFiles%\nodejs\npm.cmd
- 的%ProgramFiles%\的NodeJS \ npm.cmd
-
Go into %ProgramFiles%\nodejs\node_modules\npm and copy the file named npmrc in the new npm folder, which should be %appdata%\npm\node_modules\npm. This will tell the new npm where the global installed packages are.
进入%ProgramFiles%\ nodejs \ node_modules \ npm并在新的npm文件夹中复制名为npmrc的文件,该文件夹应为%appdata%\ npm \ node_modules \ npm。这将告诉新的npm全局安装包的位置。
-
Restart Windows and it worked.
重新启动Windows,它工作正常。
Found this over here (the npm troubleshooting section). Credits to the authors there
在这里找到了这个(npm故障排除部分)。在那里向作者致信
#4
0
I had this same problem, after setting up node.js I followed parts of a guide intended for unix and ended up moving my current working directory to a new folder, but I forgot to copy the .npmrc file from the old location to the new one. I also changed the location of my prefix away from %AppData%, which I found by using npm config ls -l
to compare my current settings to the default. The two clues here were that I had a line at the start called userconfig pointing to my .npmrc file, which was in a different location, and that my prefix was overridden from the default value. Changing this back to the default fixed the problem.
我有同样的问题,在设置node.js后,我遵循了针对unix的指南部分,最后将我当前的工作目录移动到新文件夹,但是我忘了将.npmrc文件从旧位置复制到新位置一。我还改变了我的前缀的位置,远离%AppData%,我通过使用npm config ls -l将我的当前设置与默认值进行比较。这里的两个线索是我在开始时有一行名为userconfig指向我的.npmrc文件,该文件位于不同的位置,并且我的前缀被默认值覆盖。将此更改回默认值可修复问题。
Try resetting these to the defaults and check what your config settings are. I'm not sure if reinstalling node.js would help anything if it was still referencing your old settings.
尝试将这些重置为默认值并检查您的配置设置。我不确定重新安装node.js是否会有所帮助,如果它仍然引用您的旧设置。
#5
0
Someone said it was due to npm bug https://github.com/npm/npm/issues/9696
有人说这是由于npm bug https://github.com/npm/npm/issues/9696
Adding "--force" to install allegedly works around the problem.
添加“--force”进行安装可能会解决问题。
#6
0
np init This will create a dummy package.json Open the file and enter your required dependencies list Now go for npm i This fixed the problem for me.
np init这将创建一个虚拟包.json打开文件并输入所需的依赖项列表现在转到npm i这解决了我的问题。
#7
0
I tried following solutions, I don't know which one worked for me.
我尝试了以下解决方案,我不知道哪一个适合我。
- Ran reactive-native init in command prompt as Administrator (on Windows OS), hoping works well with sudo reactive-native init on Mac OS
- 在管理员命令提示符下(在Windows操作系统上)使用active-native init,希望在Mac OS上与sudo reactive-native init配合使用
- Ran
npm cache clean
command in Command prompt. - 在命令提示符下运行npm cache clean命令。
- Disable your antivirus for time being.
- 暂时禁用您的防病毒软件。
Try any of the solution or all,
尝试任何解决方案或全部,
#8
0
This is a long standing issue with npm that they seem to have no interest in fixing. Various things others are mentioning will work sometimes (e.g. closing running programs, downgrading the version, etc...). It's been generally limited to Windows installations, though I've even had it happen a bit in Linux lately as well.
对于npm来说这是一个长期存在的问题,他们似乎没有兴趣修复。其他人提到的各种事情有时会起作用(例如关闭正在运行的程序,降级版本等等)。它通常仅限于Windows安装,尽管我最近也在Linux中发生过一些问题。
#9
0
Upgrade npm to 5.4.2 it will fix this problem.
将npm升级到5.4.2它将解决此问题。
Command to install : npm i -g npm@5.4.2 or npm i -g npm
要安装的命令:npm i -g npm@5.4.2或npm i -g npm
if still doesn't work try clearing cache using npm cache clean
如果仍然不起作用尝试使用npm cache clean清除缓存
you can use force like this npm cache clean --force
你可以使用像这样的强制缓存清理--force
#10
0
It seems that this error can manifest for more than one reason, so there probably won't be a single fix which works for everyone.
看起来这个错误可能表现不止一个原因,因此可能不会有一个适合每个人的单一修复。
However, concurrency issues often are the cause of the failing installs. According to the accumulated wisdom in one of the related npm issue threads, which has received nearly 180 comments so far, the underlying problem is
但是,并发问题通常是安装失败的原因。根据其中一个相关的npm问题线程的积累智慧,到目前为止已收到近180条评论,其根本问题在于
a race condition between asynchronous I/O operations accessing the same files on the harddisk. You can certainly influence it by cleaning up the harddisk e.g. with "npm cache verify" or moving the project to a SSD, but this does not solve the root cause of the problem.
访问硬盘上相同文件的异步I / O操作之间的竞争条件。你当然可以通过清理硬盘来影响它,例如使用“npm cache verify”或将项目移动到SSD,但这并不能解决问题的根本原因。
Likewise, closing the IDE or disabling the virus scanner works sometimes, for some people, but does not really fix the problem for good if concurrency issues are behind it.
同样,对于某些人来说,关闭IDE或禁用病毒扫描程序有时可以正常工作,但如果并发问题背后的话,并没有真正解决问题。
A patch has landed in npm 5.6.0. According to initial reports, it seems to do the trick. So if your npm --version
is lower, update to 5.6.0 (or whatever the current version is when you read this):
一个补丁已经在npm 5.6.0中登陆了。根据最初的报道,似乎可以做到这一点。因此,如果您的npm --version较低,请更新到5.6.0(或者当您阅读本文时的当前版本):
npm uninstall -g npm
npm install -g npm@5.6.0
as suggested here.
如此处所示。
If that doesn't help, then perhaps a file lock is the true cause. And closing the IDE, or disabling the virus scanner temporarily, or some similar action is indeed the way to go, as @Oly has said above.
如果这没有帮助,那么文件锁可能是真正的原因。正如@Oly上面所述,关闭IDE,暂时禁用病毒扫描程序,或类似的操作确实是要走的路。
#11
0
Delete package-lock.json
删除package-lock.json
and try again
然后再试一次
#12
0
Had the same issue Closing visual studio solved the problem
有同样的问题Closing visual studio解决了这个问题
#13
0
For me @Oly's solution worked, I'll just add for Angular folks that it was ng serve -o
that had locked the files. Yep - don't run npm install
while ng serve
is running for the project.
对我来说,@ Oly的解决方案有效,我只会为Angular人员添加一些已经锁定文件的服务-o。是的 - 当ng服务正在为项目运行时,不要运行npm install。
#14
-1
I had the same problem...here is the fix:
我有同样的问题......这是修复:
install nodejs in your local directory that does not need admin privilege.
在本地目录中安装不需要管理员权限的nodejs。
#15
-1
I changed the npm version and this did not happen again
我更改了npm版本,但这并没有再次发生
#16
-1
I just run npm cache clean
, and worked for me
我只是运行npm cache clean,并为我工作
#17
-1
I fixed by downgrading npm from 5.4.0 to version 5.3
我通过将npm从5.4.0降级到5.3版来修复
npm i -g npm@5.3
I hope this helps for you
我希望这对你有所帮助
#1
48
Kill whatever process is locking your files
It seems like this kind of error can be caused by a file permissions lock - I experienced something very similar (the same ERRNO: -4048) when installing whatwg-fetch
.
似乎这种错误可能是由文件权限锁定引起的 - 我在安装whatwg-fetch时经历了非常相似的事情(相同的ERRNO:-4048)。
I found that a Visual Studio instance I had open at the same time was acquiring all kinds of files which it didn't need. Once I closed that down, the install worked perfectly.
我发现我同时打开的Visual Studio实例正在获取它不需要的各种文件。一旦我关闭它,安装工作完美。
This may be a quickly-checked possible cause to eliminate before moving on to more drastic measures...
这可能是一个快速检查的可能原因,在采取更激烈的措施之前消除...
#2
14
if you still have troubles with this error and maybe you upgrade the node version to 5.4 > ... that version presents an error. here the solution that basically consist in downgrade node version
如果您仍然遇到此错误的麻烦,并且可能将节点版本升级到5.4> ...该版本出现错误。这里的解决方案基本上包括降级节点版本
In Windows will be:
在Windows中将是:
npm install -g npm@5.3
That's works for me.
这对我有用。
#3
9
I was having the same problem and I found the following solution:
我遇到了同样的问题,我找到了以下解决方案:
-
remove both of
删除两者
- %ProgramFiles%\nodejs\npm
- 的%ProgramFiles%\的NodeJS \ NPM
- %ProgramFiles%\nodejs\npm.cmd
- 的%ProgramFiles%\的NodeJS \ npm.cmd
-
Go into %ProgramFiles%\nodejs\node_modules\npm and copy the file named npmrc in the new npm folder, which should be %appdata%\npm\node_modules\npm. This will tell the new npm where the global installed packages are.
进入%ProgramFiles%\ nodejs \ node_modules \ npm并在新的npm文件夹中复制名为npmrc的文件,该文件夹应为%appdata%\ npm \ node_modules \ npm。这将告诉新的npm全局安装包的位置。
-
Restart Windows and it worked.
重新启动Windows,它工作正常。
Found this over here (the npm troubleshooting section). Credits to the authors there
在这里找到了这个(npm故障排除部分)。在那里向作者致信
#4
0
I had this same problem, after setting up node.js I followed parts of a guide intended for unix and ended up moving my current working directory to a new folder, but I forgot to copy the .npmrc file from the old location to the new one. I also changed the location of my prefix away from %AppData%, which I found by using npm config ls -l
to compare my current settings to the default. The two clues here were that I had a line at the start called userconfig pointing to my .npmrc file, which was in a different location, and that my prefix was overridden from the default value. Changing this back to the default fixed the problem.
我有同样的问题,在设置node.js后,我遵循了针对unix的指南部分,最后将我当前的工作目录移动到新文件夹,但是我忘了将.npmrc文件从旧位置复制到新位置一。我还改变了我的前缀的位置,远离%AppData%,我通过使用npm config ls -l将我的当前设置与默认值进行比较。这里的两个线索是我在开始时有一行名为userconfig指向我的.npmrc文件,该文件位于不同的位置,并且我的前缀被默认值覆盖。将此更改回默认值可修复问题。
Try resetting these to the defaults and check what your config settings are. I'm not sure if reinstalling node.js would help anything if it was still referencing your old settings.
尝试将这些重置为默认值并检查您的配置设置。我不确定重新安装node.js是否会有所帮助,如果它仍然引用您的旧设置。
#5
0
Someone said it was due to npm bug https://github.com/npm/npm/issues/9696
有人说这是由于npm bug https://github.com/npm/npm/issues/9696
Adding "--force" to install allegedly works around the problem.
添加“--force”进行安装可能会解决问题。
#6
0
np init This will create a dummy package.json Open the file and enter your required dependencies list Now go for npm i This fixed the problem for me.
np init这将创建一个虚拟包.json打开文件并输入所需的依赖项列表现在转到npm i这解决了我的问题。
#7
0
I tried following solutions, I don't know which one worked for me.
我尝试了以下解决方案,我不知道哪一个适合我。
- Ran reactive-native init in command prompt as Administrator (on Windows OS), hoping works well with sudo reactive-native init on Mac OS
- 在管理员命令提示符下(在Windows操作系统上)使用active-native init,希望在Mac OS上与sudo reactive-native init配合使用
- Ran
npm cache clean
command in Command prompt. - 在命令提示符下运行npm cache clean命令。
- Disable your antivirus for time being.
- 暂时禁用您的防病毒软件。
Try any of the solution or all,
尝试任何解决方案或全部,
#8
0
This is a long standing issue with npm that they seem to have no interest in fixing. Various things others are mentioning will work sometimes (e.g. closing running programs, downgrading the version, etc...). It's been generally limited to Windows installations, though I've even had it happen a bit in Linux lately as well.
对于npm来说这是一个长期存在的问题,他们似乎没有兴趣修复。其他人提到的各种事情有时会起作用(例如关闭正在运行的程序,降级版本等等)。它通常仅限于Windows安装,尽管我最近也在Linux中发生过一些问题。
#9
0
Upgrade npm to 5.4.2 it will fix this problem.
将npm升级到5.4.2它将解决此问题。
Command to install : npm i -g npm@5.4.2 or npm i -g npm
要安装的命令:npm i -g npm@5.4.2或npm i -g npm
if still doesn't work try clearing cache using npm cache clean
如果仍然不起作用尝试使用npm cache clean清除缓存
you can use force like this npm cache clean --force
你可以使用像这样的强制缓存清理--force
#10
0
It seems that this error can manifest for more than one reason, so there probably won't be a single fix which works for everyone.
看起来这个错误可能表现不止一个原因,因此可能不会有一个适合每个人的单一修复。
However, concurrency issues often are the cause of the failing installs. According to the accumulated wisdom in one of the related npm issue threads, which has received nearly 180 comments so far, the underlying problem is
但是,并发问题通常是安装失败的原因。根据其中一个相关的npm问题线程的积累智慧,到目前为止已收到近180条评论,其根本问题在于
a race condition between asynchronous I/O operations accessing the same files on the harddisk. You can certainly influence it by cleaning up the harddisk e.g. with "npm cache verify" or moving the project to a SSD, but this does not solve the root cause of the problem.
访问硬盘上相同文件的异步I / O操作之间的竞争条件。你当然可以通过清理硬盘来影响它,例如使用“npm cache verify”或将项目移动到SSD,但这并不能解决问题的根本原因。
Likewise, closing the IDE or disabling the virus scanner works sometimes, for some people, but does not really fix the problem for good if concurrency issues are behind it.
同样,对于某些人来说,关闭IDE或禁用病毒扫描程序有时可以正常工作,但如果并发问题背后的话,并没有真正解决问题。
A patch has landed in npm 5.6.0. According to initial reports, it seems to do the trick. So if your npm --version
is lower, update to 5.6.0 (or whatever the current version is when you read this):
一个补丁已经在npm 5.6.0中登陆了。根据最初的报道,似乎可以做到这一点。因此,如果您的npm --version较低,请更新到5.6.0(或者当您阅读本文时的当前版本):
npm uninstall -g npm
npm install -g npm@5.6.0
as suggested here.
如此处所示。
If that doesn't help, then perhaps a file lock is the true cause. And closing the IDE, or disabling the virus scanner temporarily, or some similar action is indeed the way to go, as @Oly has said above.
如果这没有帮助,那么文件锁可能是真正的原因。正如@Oly上面所述,关闭IDE,暂时禁用病毒扫描程序,或类似的操作确实是要走的路。
#11
0
Delete package-lock.json
删除package-lock.json
and try again
然后再试一次
#12
0
Had the same issue Closing visual studio solved the problem
有同样的问题Closing visual studio解决了这个问题
#13
0
For me @Oly's solution worked, I'll just add for Angular folks that it was ng serve -o
that had locked the files. Yep - don't run npm install
while ng serve
is running for the project.
对我来说,@ Oly的解决方案有效,我只会为Angular人员添加一些已经锁定文件的服务-o。是的 - 当ng服务正在为项目运行时,不要运行npm install。
#14
-1
I had the same problem...here is the fix:
我有同样的问题......这是修复:
install nodejs in your local directory that does not need admin privilege.
在本地目录中安装不需要管理员权限的nodejs。
#15
-1
I changed the npm version and this did not happen again
我更改了npm版本,但这并没有再次发生
#16
-1
I just run npm cache clean
, and worked for me
我只是运行npm cache clean,并为我工作
#17
-1
I fixed by downgrading npm from 5.4.0 to version 5.3
我通过将npm从5.4.0降级到5.3版来修复
npm i -g npm@5.3
I hope this helps for you
我希望这对你有所帮助