本人开始进入react神坑啦 ,今天在自己构建react脚手架的时候 碰到了一个坑,花了一个小时才搞明白,下面介绍一下吧 首先,按照官方教程开始搭建 1、npx creat-react-app my-app 2、npm init react-app my-app 3、npm start 看上去没有问题的步骤,这个时候就报错了
1.cd your project path (ignore)
2.rm -rf node_modules
3.npm install (don't use yarn )
npm run start success
这样就大功告成啦!!! 其实在遇到这个Bug之前还有一个Bug , Error: ENOENT: no such file or directory, open '/Users/yuanhaijing/package.json' 这个我初步估计为是因为不是在全局安装的脚手架 ,因为我没有在admin用户上。