简体   繁体   English

npm-EPERM:不允许操作,请在Windows上阅读

[英]npm - EPERM: operation not permitted ,read On Windows

I have problem when i try to run npm start 我尝试运行npm start时遇到问题

Error: EPERM: operation not permitted, read at Object.readSync (fs.js:498:3) at Object.readSync (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\graceful-fs\\polyfills.js:143:28) at tryReadSync (fs.js:332:20) at Object.readFileSync (fs.js:361:19) at Object. 错误:EPERM:不允许操作,请在Object.readSync(C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\ node_modules \\ graceful-fs \\ polyfills.js:143:的Object.readSync(fs.js:498:3)处读取: 28)在Object的tryReadSync(fs.js:332:20)在Object.readFileSync(fs.js:361:19)。 (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:220:39) at Generator.next () at asyncGeneratorStep (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:78:24) at _next (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:98:9) at C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:103:7 at new Promise () type: 'Error', errno: -4048, syscall: 'read', code: 'EPERM' } (node:14128) UnhandledPromiseRejectionWarning: Error: EPERM: operation not permitted, read at Object.readSync (fs.js:498:3) at Object.readSync (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\graceful-fs\\polyfills.js:143:28) at tryReadSync (fs.js:332:20) at Object.readFileSync (fs.js:361:19) at Object. (C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\ node_modules \\ jest-haste-map \\ build \\ worker.js:220:39)在asyncGeneratorStep(C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\)处Generator.next() _next(C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\ node_modules \\ jest-haste-map \\ build \\ worker.js:98:9)上的node_modules \\ jest-haste-map \\ build \\ worker.js:78:24)在C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\ node_modules \\ jest-haste-map \\ build \\ worker.js:103:7在新Promise()处输入:'Error',errno:-4048,syscall:'read' ,代码:“ EPERM”}(节点:14128)UnhandledPromiseRejectionWarning:错误:EPERM:不允许操作,请在Object.readSync(f:js:498:3)处的Object.readSync(C:\\ Users \\ Nidhal \\ ReactProjects \\ DietRead \\ node_modules \\ graceful-fs \\ polyfills.js:143:28)在Object的tryReadSync(fs.js:332:20)在Object.readFileSync(fs.js:361:19)。 (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:220:39) at Generator.next () at asyncGeneratorStep (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:78:24) at _next (C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:98:9) at C:\\Users\\Nidhal\\ReactProjects\\dieton\\node_modules\\jest-haste-map\\build\\worker.js:103:7 at new Promise () (node:14128) UnhandledPromiseRejectionWarning: Unhandled promise rejection. (C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\ node_modules \\ jest-haste-map \\ build \\ worker.js:220:39)在asyncGeneratorStep(C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\)处Generator.next() _next(C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\ node_modules \\ jest-haste-map \\ build \\ worker.js:98:9)上的node_modules \\ jest-haste-map \\ build \\ worker.js:78:24)在C:\\ Users \\ Nidhal \\ ReactProjects \\ dieton \\ node_modules \\ jest-haste-map \\ build \\ worker.js:103:7在新Promise()(node:14128)处UnhandledPromiseRejectionWarning警告:未处理的承诺拒绝。 This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). 引发此错误的原因可能是抛出了一个没有catch块的异步函数,或者是拒绝了一个.catch()无法处理的承诺。 (rejection id: 1) (node:14128) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. (拒绝ID:1)(节点:14128)[DEP0018] DeprecationWarning:已弃用未处理的承诺拒绝。 In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 将来,未处理的承诺拒绝将以非零退出代码终止Node.js进程。

We recommend installing Node and Python2 via Chocolatey , a popular package manager for Windows. 我们建议通过Chocolatey (适用于Windows的流行软件包管理器)安装NodePython2

  1. Open an Administrator Command Prompt (right click Command Prompt and select "Run as Administrator"), then run the following command: 打开管理员命令提示符(右键单击命令提示符,然后选择“以管理员身份运行”),然后运行以下命令:

    choco install -y nodejs.install python2 jdk8

If you have already installed Node on your system, make sure it is Node 8.3 or newer. 如果您已经在系统上安装了Node,请确保它是Node 8.3或更高版本。 If you already have a JDK on your system, make sure it is version 8 or newer. 如果您的系统上已经有JDK ,请确保它是version 8或更高版本。

  1. npm install -g react-native-cli
  2. Install Android Studio 安装Android Studio
  3. Configure the ANDROID_HOME environment variable 配置ANDROID_HOME环境变量 android首页
  4. react-native init YourProject
  5. cd YourProject
  6. react-native run-android

Detailed description of the installation methods of installation 安装方法的详细说明

Here is the few possible solution, you may try. 这是一些可能的解决方案,您可以尝试。 Otherwise explain the issue in details 否则详细解释该问题

To access and make a change to current directory you need to run cmd as administrator. 要访问当前目录并进行更改,您需要以管理员身份运行cmd。

Try to run cmd as administrator 尝试以管理员身份运行cmd

Then do npm start, that will works in a normal console. 然后执行npm start,它将在普通控制台中工作。

Otherwise- 除此以外-

npm cache clean --force npm缓存清理--force

npm cache verify npm缓存验证

Otherwise - You may also try to downgrade or upgrade the npm version 否则-您也可以尝试降级或升级npm版本

To uninstall: 卸载:

npm uninstall npm -g npm卸载npm -g

Install the Latest version: 安装最新版本:

npm install -g npm@latest npm install -g npm @ latest

or 要么

Install the previous version: 安装以前的版本:

npm install npm@5.3 -g npm安装npm@5.3 -g

我建议您关闭用于打开代码文件的IDE(VSCode / WebStorm / etc),然后尝试npm install

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

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