gpt4 book ai didi

reactjs - create-react-app 只创建 node_modules、package 和 package-lock

转载 作者:行者123 更新时间:2023-12-04 10:03:32 25 4
gpt4 key购买 nike

在我的终端中:

D:\>npx create-react-app myapp                                                                                      
npx: installed 98 in 21.893s

Creating a new React app in D:\myapp.

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


> core-js@2.6.11 postinstall D:\myapp\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.6.5 postinstall D:\myapp\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.6.5 postinstall D:\myapp\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

+ react-scripts@3.4.1
+ react-dom@16.13.1
+ cra-template@1.0.3
+ react@16.13.1
added 1613 packages from 750 contributors and audited 921730 packages in 287.89s

58 packages are looking for funding
run `npm fund` for details

found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details

安装后我的 package.json:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"cra-template": "1.0.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-scripts": "3.4.1"
}
}

然后它永远卡在那里。
我尝试安装全局 create-react-app,更新最新的 npm,删除 Appdata 中的 npm 仍然无效,需要帮助

最佳答案

从 create-react-app 3.3.0 开始,不再推荐使用 CRA 的全局安装。
这是 github 上提出的问题,但后来在此解决方案后关闭

npm rm -g create-react-app
npm install create-react-app
npx create-react-app my-app
它所做的只是:

Command 1: deletes the create-react-app installed globally

Command 2: Installs create-react-app locally

Command 3: Creates a new react-app with all the expected file structure.


试试这个,如果那也不起作用,请检查以下说明...
仅适用于 Windows 用户
对于很多 Windows 用户来说,这是一个问题。

Even after trying all the troubleshooting steps did not resolve the issue.

Finally it was found that they had some missing paths in their environment variables.


注意:我们这里不是在讨论设置 npm 路径
在将这些添加到 env 变量之前,它没有得到解决。
C:\Windows;C:\Windows\system32;C:\Windows\System32\Wbem
它区分大小写,完全按照它提到的方式粘贴
但是,随着时间的推移,这些错误变得越来越少,不确定这是否会有所帮助。

关于reactjs - create-react-app 只创建 node_modules、package 和 package-lock,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61708568/

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