F:\reactjs\project-1>create-react-app hello-world
Creating a new React app in F:\reactjs\project-1\hello-world.
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 '...dir-recursive":"^0.1.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HP\AppData\Roaming\npm-cache\_logs\2018-01-25T17_55_33_855Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting hello-world / from F:\reactjs\project-1
Done.
我的npm版本是-5.6.0
答案 0 :(得分:1)
它的defo看起来像一个PATH VARIABLE问题,也是npm问题。我建议从您的计算机上卸载Node并启动并运行最新的Node,或者将您的npm降级到版本4.还有一种方法可以执行此操作:在您的npm中找到create-react-app文件夹modules文件夹,并复制路径,并将其直接粘贴到高级环境变量路径中。是的,手动完成。这可能会解决问题。