Reactjs 安装react路由器dom后,react不会启动
我是新来的反应者,问题是: 我的react应用程序在我安装的Ubuntu机器上运行良好Reactjs 安装react路由器dom后,react不会启动,reactjs,Reactjs,我是新来的反应者,问题是: 我的react应用程序在我安装的Ubuntu机器上运行良好react路由器dom npm i --save react-router-dom 现在我不能再开始反应了: me@desktop:~/front-myapp$ npm start > front-myapp@0.1.0 start /home/me/front-myapp > react-scripts start sh: 1: react-scripts: not found npm E
react路由器dom
npm i --save react-router-dom
现在我不能再开始反应了:
me@desktop:~/front-myapp$ npm start
> front-myapp@0.1.0 start /home/me/front-myapp
> react-scripts start
sh: 1: react-scripts: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! front-myapp@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the front-myapp@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/me/.npm/_logs/2018-09-03T04_38_54_369Z-debug.log
erro日志文件如下所示:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@5.6.0
3 info using node@v8.11.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle front-myapp@0.1.0~prestart: front-myapp@0.1.0
6 info lifecycle front-myapp@0.1.0~start: front-myapp@0.1.0
7 verbose lifecycle front-myapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle front-myapp@0.1.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/me$
9 verbose lifecycle front-myapp@0.1.0~start: CWD: /home/me/front-myapp
10 silly lifecycle front-myapp@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 info lifecycle front-myapp@0.1.0~start: Failed to exec start script
12 verbose stack Error: front-myapp@0.1.0 start: `react-scripts start`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at emitTwo (events.js:126:13)
12 verbose stack at ChildProcess.emit (events.js:214:7)
12 verbose stack at maybeClose (internal/child_process.js:925:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
13 verbose pkgid front-myapp@0.1.0
14 verbose cwd /home/me/front-myapp
15 verbose Linux 4.15.0-33-generic
16 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
17 verbose node v8.11.4
18 verbose npm v5.6.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error front-myapp@0.1.0 start: `react-scripts start`
23 error spawn ENOENT
24 error Failed at the front-myapp@0.1.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
如何解决此问题?即使这很棘手:
rm-rf节点模块
npm安装
react scripts
是一个有点麻烦的软件包,因此很可能是从node\u modules
文件夹中删除的,尽管它很棘手:
rm-rf节点模块
npm安装
react scripts
是一个有点麻烦的软件包,所以很可能是从node\u modules
文件夹中删除的,你能检查一下你是否有node\u modules
目录吗?或者,运行npm安装
,然后运行npm启动
。是否可以检查是否有node\u模块
目录?或者,运行npm安装
,然后运行npm启动
。也接受它?当然,但需要等待10分钟!也接受它?当然,但需要等待10分钟!
{
"name": "front-myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}