gpt4 book ai didi

reactjs - create-react-app 无法在 Windows 10 中创建新的 React 应用程序

转载 作者:行者123 更新时间:2023-12-03 13:21:29 24 4
gpt4 key购买 nike

我安装了 Create-react-app 版本 1.4.3。当我尝试创建新的 App 时,我在命令提示符中收到以下消息。请帮助我找到并解决问题。

C:\Users\GSI-KOL\Desktop\server>create-react-app client

Creating a new React app in C:\Users\GSI-KOL\Desktop\server\client.

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\GSI-KOL\Desktop\server\client\node_modules\uglifyjs-webpack-plugin
node lib/post_install.js

npm ERR! path C:\Users\GSI-KOL\Desktop\server\client\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall lstat
npm ERR! Error: EPERM: operation not permitted, lstat 'C:\Users\GSI-KOL\Desktop\server\client\node_modules\fsevents\node_modules'
npm ERR! { Error: EPERM: operation not permitted, lstat 'C:\Users\GSI-KOL\Desktop\server\client\node_modules\fsevents\node_modules'
npm ERR! stack: 'Error: EPERM: operation not permitted, lstat \'C:\\Users\\GSI-KOL\\Desktop\\server\\client\\node_modules\\fsevents\\node_modules\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'lstat',
npm ERR! path: 'C:\\Users\\GSI-KOL\\Desktop\\server\\client\\node_modules\\fsevents\\node_modules' }
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\GSI-KOL\AppData\Roaming\npm-cache\_logs\2017-11-08T13_08_03_705Z-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 client / from C:\Users\GSI-KOL\Desktop\server
Done.

C:\Users\GSI-KOL\Desktop\server>

最佳答案

我也遇到了同样的问题。这是由于 npm 的问题。

请在命令行中运行以下命令

npm cache clean --force

然后运行

create-react-app <project Name>

如果问题仍然存在,请从 npm 切换到yarn

运行以下命令,它解决了我的问题

npm install -g yarn

yarn global add create-react-app

create-react-app <projectname>

关于reactjs - create-react-app 无法在 Windows 10 中创建新的 React 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47180722/

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