[英]I can't install react using npx create-react-app is this aNodist the issue?
[英]I'm having a problem that can't create react app using npx command
我不能使用npx create-react-app <projectname>
创建我的反应项目。
控制台给出了这个:
Must use import to load ES Module: C:\Users\user\AppData\Roaming\npm-cache\_npx\4536\node_modules\create-react-app\node_modules\is-promise\index.js // require() of ES modules is not supported. // require() of C:\Users\user\AppData\Roaming\npm-cache\_npx\4536\node_modules\create-react-app\node_modules\is-promise\index.js from C:\Users\user\AppData\Roaming\npm-cache\_npx\4536\node_modules\create-react-app\node_modules\run-async\index.js is an ES module file as it is a.js file whose nearest parent package.json contains "type": "module" which defines all.js files in that package scope as ES modules. // Instead rename C:\Users\user\AppData\Roaming\npm-cache\_npx\4536\node_modules\create-react-app\node_modules\is-promise\index.js to end in.cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\user\AppData\Roaming\npm-cache\_npx\4536\node_modules\create-react-app\node_modules\is-promise\package.json.
在安装create-react-app
之前清理你的npm
缓存。
npm cache clean --force
然后全局安装create-react-app
。
npm install -g create-react-app
然后您可以使用create-react-app
创建您的反应应用程序
create-react-app my-app
然后导航到my-app
并运行
npm start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.