简体   繁体   English

npm 错误! 错误:EPERM:不允许操作,取消链接

[英]npm ERR! Error: EPERM: operation not permitted, unlink

  • OS : Windows 10.操作系统:Windows 10。
  • npm version : 6.9.0 npm 版本:6.9.0
  • node version : 12.4.0节点版本:12.4.0

I'm working on an expo application.我正在开发一个世博会应用程序。 I would like to install all the packages on my expo application (npm install).我想在我的 expo 应用程序(npm install)上安装所有软件包。 But, an error occured :但是,发生了错误:

17254 error [OperationalError: EPERM: operation not permitted, unlink ... I have seen this error on many subjects, but no one answer to my problem. 17254 error [OperationalError: EPERM: operation not permitted, unlink ...我在许多主题上都看到过这个错误,但没有人回答我的问题。

I've already tried to :我已经尝试过:

  1. Launch my terminal as an administrator.以管理员身份启动我的终端。
  2. npm config set safe-perm=true. npm 配置设置安全烫发=真。
  3. npm install --no-bin-links npm install --no-bin-links
  4. npm cache clear --force npm 缓存清除 --force

An exemple of error message that I have :我有一个错误消息的例子:

17254 error   cause: [Error: EPERM: operation not permitted, unlink 'C:\Users\Thomas\Desktop\someDirectory\someDirectory\someDirectory\someDirectory\node_modules\.staging\react-native-99ed309f\Libraries\Renderer\oss\ReactFabric-dev.js'] {
17254 error     errno: -4048,
17254 error     code: 'EPERM',
17254 error     syscall: 'unlink',
17254 error     path: 'C:\\Users\\Thomas\\Desktop\\someDirectory\\someDirectory\\someDirectory\\someDirectory\\node_modules\\.staging\\react-native-99ed309f\\Libraries\\Renderer\\oss\\ReactFabric-dev.js'
17254 error   },
17254 error   stack: 'Error: EPERM: operation not permitted, unlink ' +
17254 error     "'C:\\Users\\Thomas\\Desktop\\someDirectory\\someDirectory\\someDirectory\\someDirectory\\node_modules\\.staging\\react-native-99ed309f\\Libraries\\Renderer\\oss\\ReactFabric-dev.js'",
17254 error   errno: -4048,
17254 error   code: 'EPERM',
17254 error   syscall: 'unlink',
17254 error   path: 'C:\\Users\\Thomas\\Desktop\\someDirectory\\someDirectory\\someDirectory\\someDirectory\\node_modules\\.staging\\react-native-99ed309f\\Libraries\\Renderer\\oss\\ReactFabric-dev.js'
17254 error }
17255 error The operation was rejected by your operating system.
17255 error It's possible that the file was already in use (by a text editor or antivirus),
17255 error or that you lack permissions to access it.
17255 error
17255 error If you believe this might be a permissions issue, please double-check the
17255 error permissions of the file and its containing directories, or try running
17255 error the command again as root/Administrator (though this is not recommended).
17256 verbose exit [ -4048, true ] ```

Is there a another instance of node running, that is also using ReactFabric-dev.js?是否有另一个运行节点的实例,它也在使用 ReactFabric-dev.js? If so, terminate and retry.如果是,请终止并重试。 Also try to move your project to a folder "closer" to root.还尝试将您的项目移动到“更接近”根目录的文件夹。 Windows sometimes gets confused with very long paths. Windows 有时会与很长的路径混淆。

Solved it by logging into npmjs: npm login通过登录 npmjs 解决: npm login

or或者

uninstall all npm modules and re-install with npm install --no-bin-links卸载所有 npm 模块并使用npm install --no-bin-links重新安装

or或者

rd /s /q C:\Users\foo\AppData\Roaming\npm-cache
rd /s /q C:\Users\foo\AppData\Roaming\npm

I had this error message, to solve it you have to:我收到此错误消息,要解决它,您必须:

1) add your project folder in Windows Defender exclusions list . 1) 在Windows Defender 排除列表中添加您的项目文件夹。

2) remove your node_modules folder 2) 删除您的 node_modules 文件夹

3) run: 3)运行:

npm install

What I did is:我所做的是:

  1. Deleted node_modules folder;删除了 node_modules 文件夹;

  2. Opened VSCode as administrator;以管理员身份打开VSCode;

  3. Ran the following commands in terminal:在终端中运行以下命令:

    npm cache clean --force

    npm install

Try installing it globally first, using the command首先尝试使用命令全局安装它

  • npm install -g create-react-app npm install -g create-react-app

And then, you can create your app using the command,然后,您可以使用以下命令创建您的应用程序,

  • npx create-react-app <Name_of_your_app> npx create-react-app <Name_of_your_app>

Make sure that the terminal has permission to access the folder.确保终端有权访问该文件夹。 Here is good documentation that can he 是很好的文档,他可以

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

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