当前位置 : 主页 > 网页制作 > React >

reactjs – 撤消’npm run eject’的反应

来源:互联网 收集:自由互联 发布时间:2021-06-15
我试图用反应CDN脚本来测试我的React应用程序(使用create-react-app创建)的性能,然后我做了’npm run eject’来添加 webpack externals依赖项反应和反应. 我在webpack配置和 script中轻松完成了在inde
我试图用反应CDN脚本来测试我的React应用程序(使用create-react-app创建)的性能,然后我做了’npm run eject’来添加 webpack externals依赖项反应和反应.
 
我在webpack配置和< 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

我怎样才能恢复到主分支?

如果您现在处于主分支(哪个配置与npm run eject之前相同),请尝试以下操作.

>删除node_module> npm安装> npm开始

网友评论