【问题标题】:npx create-react-app my-app giving me the following error after installing new version of NodeJS?npx create-react-app my-app 在安装新版本的 NodeJS 后给我以下错误?
【发布时间】:2021-11-10 13:49:55
【问题描述】:

我安装了新版本的 NodeJS,之后我尝试创建-react-app,并且在运行命令 npx create-react-app my-app 时出现以下错误:

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject> npm -v          
8.1.0
PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject> node -v
    v16.13.0
PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject> npx create-react-app my-app
npm ERR! code EPERM  
npm ERR! syscall open
npm ERR! path C:\Users\Firstname~1\AppData\Roaming\npm-cache\_cacache\tmp\724ab6af
npm ERR! errno EPERM
npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/create-react-app: EPERM: operation not permitted, open 'C:\Users\Firstname~1\AppData\Roaming\npm-cache\_cacache\tmp\724ab6af'
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR!     at async C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:106:12
npm ERR!     at async Promise.all (index 0)
npm ERR!     at async exec (C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:94:17)      
npm ERR!  FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/create-react-app: EPERM: 
    operation not permitted, open 'C:\Users\Firstname~1\AppData\Roaming\npm-cache\_cacache\tmp\724ab6af'
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
npm ERR!     at async C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:106:12
npm ERR!     at async Promise.all (index 0)
npm ERR!     at async exec (C:\Program Files\nodejs\node_modules\npm\node_modules\libnpmexec\lib\index.js:94:17) {    
npm ERR!   code: 'EPERM',
npm ERR!   errno: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\\Users\\Firstname~1\\AppData\\Roaming\\npm-cache\\_cacache\\tmp\\724ab6af',
npm ERR!   type: 'system'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
PS E:\ALL ABOUT React\Jonas Projects\Jonass Project Practice\myproject>

【问题讨论】:

  • 尝试以管理员身份打开外壳?
  • 是的,已经尝试过
  • 它在 C: 上工作吗?
  • 这在 C 上意味着什么,我是新来的反应,这就是为什么没有足够的知识,试图从过去 3 天弄清楚但没有任何帮助,还有一件事,我的旧项目是运行良好,但 npx create-react-app my-app 给出错误
  • 对不起,我的意思是在C: 驱动器上,你尝试在E: 上运行它我猜这不是你的主驱动器不是吗?

标签: javascript node.js reactjs npm


【解决方案1】:

试试这个:

npx create-react-app my-app

代替:

npx-create-react-app my-app

项目名称不应大写或破折号(-)之类的符号

【讨论】:

    猜你喜欢
    • 2021-09-07
    • 2022-06-14
    • 2020-08-11
    • 2019-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    相关资源
    最近更新 更多