【发布时间】:2018-12-29 11:38:46
【问题描述】:
我正在尝试使用 react CDN 脚本测试我的 React 应用程序(使用 create-react-app 创建)的性能,我做了 'npm runeject' 来添加 webpack externals 依赖项 react 和 react-dom。
我在 webpack config 和 <script> 在 index.html
...
externals: {
react: 'React',
'react-dom':'ReactDOM'
},
...
现在我想将其恢复到以前的状态
我正在使用 git,我在一个单独的分支中做了这个实验。
我跑了git checkout master 和npm start
结果很烦人
> myapp@0.18.1 start /home/code/serverSync/myapp/ui
> react-scripts start
sh: 1: react-scripts: not found
npm ERR! Linux 4.15.0-23-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! myapp@0.18.1 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the myapp@0.18.1 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the myapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs myapp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls myapp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/code/serverSync/myapp/ui/npm-debug.log
如何恢复到 master 分支?
【问题讨论】:
-
你可能需要再次 npm install ,看起来弹出卸载了一些依赖项。
-
我也关注了该链接,但没有运气(rm -r scripts/ , $ rm -r config/ 在我运行 git checkout 时已经为空)
-
遵循@jonrsharpe 建议
npm install并已解决(react-scripts@1.1.0已重新安装)。谢谢。
标签: reactjs webpack create-react-app