我使用 npm 在 Node JS 上安装了最新版本,但无法运行 create-react-app。出现以下问题:
Creating a new React app in C:\wamp64\www\bob.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '....tgz"}},"2.3.4":{"nam'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ivana\AppData\Roaming\npm-cache_logs\2019-02-26T21_21_48_727Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting bob/ from C:\wamp64\www
Done.
Run Code Online (Sandbox Code Playgroud)
版本:
Node v10.15.1
npm 6.7.0
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
运行 npm cache clean --force 后
发生另一个错误:
$ create-react-app 鲍勃
Creating a new React app in C:\Users\Ivana\bob.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '...,"@babel/plugin-synta'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ivana\AppData\Roaming\npm-cache\_logs\2019-02-27T09_18_28_856Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting bob/ from C:\Users\Ivana
Done.
Run Code Online (Sandbox Code Playgroud)
来自https://github.com/facebook/create-react-app#creating-an-app
npx create-react-app my-app
Run Code Online (Sandbox Code Playgroud)
(npx 随 npm 5.2+ 及更高版本一起提供)
但是你用
create-react-app my-app
如果您使用 npm 5.1 或更早版本,则不能使用 npx。相反,全局安装 create-react-app:
npm install -g create-react-app
Run Code Online (Sandbox Code Playgroud)
现在你可以运行:
create-react-app my-app
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8349 次 |
| 最近记录: |