我进入了我的React程序的根目录,并尝试npm start
,但是它不再起作用。在开始之前,我也尝试过npm install
,但遇到相同的错误。
这是由于某种原因安装Java之后发生的。此后,我将其卸载并删除了JRE和JDK目录的路径。我还尝试从npm站点重新安装npm。
这是我尝试运行程序时收到的错误消息
npm ERR! file C:\Program Files\Java\jdk1.8.0_211\jre
npm ERR! path C:\Program Files\Java\jdk1.8.0_211\jre
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\Program Files\Java\jdk1.8.0_211\jre
npm ERR! create-react-redux-app@0.1.0 start: `react-scripts start`
npm ERR! spawn C:\Program Files\Java\jdk1.8.0_211\jre ENOENT
npm ERR!
npm ERR! Failed at the create-react-redux-app@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! C:\Users\James Damazos\AppData\Roaming\npm-cache\_logs\2019-05-06T17_45_48_357Z-debug.log
我的npm版本是6.4.1。我从环境变量中删除了jdk1.8.0_211
的路径,但我不知道为什么它仍然在错误消息中搜索
作为参考,这是我的package.json
{
"name": "create-react-redux-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^3.0.1",
"bad-words": "^1.6.4",
"bignumber.js": "^7.2.1",
"font-awesome": "^4.7.0",
"gsap": "^2.0.2",
"history": "^4.7.2",
"immutable": "^3.8.1",
"jquery": "^3.3.1",
"material-icons-react": "^1.0.2",
"prop-types": "^15.5.10",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"react-icons": "3.2.2",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.0",
"react-router-redux": "^5.0.0-alpha.6",
"react-select": "^2.0.0",
"react-slidedown": "^1.3.0",
"react-spinkit": "^3.0.0",
"react-tooltip": "^3.6.1",
"react-web3": "^0.4.5",
"react-youtube": "^7.8.0",
"redux": "^3.7.2",
"redux-devtools-extension": "^2.13.5",
"redux-saga": "^0.15.6",
"sweetalert2": "^7.26.12",
"uuid": "^3.3.2",
"web3": "github:ethereum/web3.js"
},
"devDependencies": {
"eslint": "5.6.0",
"eslint-config-airbnb": "15.1.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.3.0",
"lint-staged": "^4.0.4",
"pre-commit": "^1.2.2",
"react-scripts": "2.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "npm run lint:js",
"lint:staged": "lint-staged",
"lint:js": "eslint --ext .js src/"
},
"pre-commit": "lint:staged",
"lint-staged": {
"*.js": "lint:js"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
这是我的日志文件的样子
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle create-react-redux-app@0.1.0~prestart: create-react-redux-app@0.1.0
6 info lifecycle create-react-redux-app@0.1.0~start: create-react-redux-app@0.1.0
7 verbose lifecycle create-react-redux-app@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle create-react-redux-app@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\marbleGenerator\MibsFrontEnd\node_modules\.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\nodejs\;C:\Users\James Damazos\.windows-build-tools\python27\;C:\Users\James Damazos\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\James Damazos\AppData\Roaming\npm\node_modules\windows-build-tools\node_modules\.bin;C:\Users\James Damazos\AppData\Roaming\npm\node_modules\.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Users\James Damazos\AppData\Local\Microsoft\WindowsApps;C:\Users\James Damazos\AppData\Local\atom\bin;C:\Users\James Damazos\AppData\Local\atom;C:\cygwin64\bin;D:\Scrap\remixd\bin;C:\Users\James Damazos\AppData\Local\Microsoft\WindowsApps;D:\Microsoft VS Code\bin;D:\watchman.exe;C:\Users\James Damazos\AppData\Roaming\npm
9 verbose lifecycle create-react-redux-app@0.1.0~start: CWD: D:\marbleGenerator\MibsFrontEnd
10 silly lifecycle create-react-redux-app@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 info lifecycle create-react-redux-app@0.1.0~start: Failed to exec start script
12 silly lifecycle create-react-redux-app@0.1.0~start: Returned: code: -4058 signal: null
13 info lifecycle create-react-redux-app@0.1.0~start: Failed to exec start script
14 verbose stack Error: create-react-redux-app@0.1.0 start: `react-scripts start`
14 verbose stack spawn C:\Program Files\Java\jdk1.8.0_211\jre ENOENT
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
14 verbose stack at onErrorNT (internal/child_process.js:415:16)
14 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19)
15 verbose pkgid create-react-redux-app@0.1.0
16 verbose cwd D:\marbleGenerator\MibsFrontEnd
17 verbose Windows_NT 10.0.17763
18 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 verbose node v10.15.3
20 verbose npm v6.4.1
21 error file C:\Program Files\Java\jdk1.8.0_211\jre
22 error path C:\Program Files\Java\jdk1.8.0_211\jre
23 error code ELIFECYCLE
24 error errno ENOENT
25 error syscall spawn C:\Program Files\Java\jdk1.8.0_211\jre
26 error create-react-redux-app@0.1.0 start: `react-scripts start`
26 error spawn C:\Program Files\Java\jdk1.8.0_211\jre ENOENT
27 error Failed at the create-react-redux-app@0.1.0 start script.
27 error This is probably not a problem with npm. There is likely additional logging output above.
28 verbose exit [ 1, true ]