首先,我使用以下命令全局安装了create-react-app模块:
$ npm install --no-fund -g create-react-app
C:\Users\TEMP\AppData\Roaming\npm\create-react-app ->
C:\Users\TEMP\AppData\Roaming\npm\node_modules\create-react-app\index.js
+ create-react-app@3.4.1
added 98 packages from 46 contributors in 34.95s
我使用--no-fund一词,是因为在尝试时不使用--no-fund一词时会遇到一些错误。 然后,我尝试使用以下方法创建一个新项目:
$ npx create-react-app portfolio
但随后收到此错误消息:
npm ERR! Unexpected end of JSON input while parsing near
'...TqFfTSyr8Sk6w8cVFWCZD'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\TEMP\AppData\Roaming\npm-cache\_logs\2020-09-06T17_40_35_778Z-debug.log
我已经尝试过在全球范围内卸载npm create-react-app,然后将其重新安装在上面。卸载并重新安装解决方案不适用于我。
我正在对所有这些命令使用Git Bash。