gpt4 book ai didi

node.js - create-react-app 因没有权限错误而崩溃

转载 作者:太空宇宙 更新时间:2023-11-03 21:53:41 25 4
gpt4 key购买 nike

当我尝试创建 react 应用程序时,出现此错误。请帮助我。我尝试使用管理权限,并且卸载并重新安装nodejs仍然显示相同的错误。

Creating a new React app in C:\Users\chandan\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...


> uglifyjs-webpack-plugin@0.4.6 postinstall C:\Users\chandan\my-app\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm ERR! path C:\Users\chandan\my-app\node_modules\nan\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\chandan\my-app\node_modules\nan\package.json'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\chandan\my-app\node_modules\nan\package.json'
npm ERR! at Error (native)
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\chandan\\my-app\\node_modules\\nan\\package.json\'\n at Error (native)',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\chandan\\my-app\\node_modules\\nan\\package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\chandan\AppData\Roaming\npm-cache\_logs\2017-09-11T04_28_57_244Z-debug.log

Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting my-app / from C:\Users\chandan
Done.

最佳答案

使用以下命令清理缓存:

npm cache clean -f

然后卸载 create-react-app 模块并再次安装并创建新应用程序。

更新:

安装最新版本的 npm/node 并尝试。

关于node.js - create-react-app 因没有权限错误而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46148416/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com