使用react-app-rewire的create-react-app无法npm运行弹出

时间:2018-08-05 19:24:00

标签: reactjs npm mobx

长话短说。我有一个带有react-app-rewire的create-react-app(我的应用未弹出)。由于mobx @装饰器,我无法部署我的应用程序。要解决此问题,我需要先运行npmject(或者还有其他方法吗?)。那就是我得到一个错误的地方:

module.js:538
throw err;
^

Error: Cannot find module '../scripts/eject'
at Function.Module._resolveFilename (module.js:536:15)
at Function.resolve (internal/module.js:18:19)
at Object.<anonymous> 
(C:\Users\Hladni\Desktop\Shit\Radovi\react\ppoll\node_modules\react-app-rewired\bin\index.js:19:25)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ppoll@0.1.0 eject: `react-app-rewired eject`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ppoll@0.1.0 eject 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:
...debug.log

我的package.json看起来像这样:

{
"name": "ppoll",
"version": "0.1.0",
"private": true,
"dependencies": {
  "chart.js": "^2.7.2",
  "firebase": "^5.2.0",
  "mobx": "^5.0.3",
  "mobx-react": "^5.2.3",
  "node-sass-chokidar": "^1.3.0",
  "npm-run-all": "^4.1.3",
  "prop-types": "^15.6.2",
  "react": "^16.4.1",
  "react-app-rewire-mobx": "^1.0.8",
  "react-app-rewired": "^1.5.2",
  "react-chartjs-2": "^2.7.4",
  "react-dom": "^16.4.1",
  "react-router": "^4.3.1",
  "react-router-dom": "^4.3.1",
  "react-scripts": "1.1.4"
},
"scripts": {
  "build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
  "watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
  "start-js": "react-app-rewired start",
  "start": "npm-run-all -p watch-css start-js",
  "build": "npm run build-css && react-scripts build",
  "test": "react-app-rewired test --env=jsdom",
  "eject": "react-app-rewired eject"
  }
}

错误debug.log是这样的:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Hladni\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'eject' ]
2 info using npm@6.0.1
3 info using node@v8.9.3
4 verbose run-script [ 'preeject', 'eject', 'posteject' ]
5 info lifecycle ppoll@0.1.0~preeject: ppoll@0.1.0
6 info lifecycle ppoll@0.1.0~eject: ppoll@0.1.0
7 verbose lifecycle ppoll@0.1.0~eject: unsafe-perm in lifecycle true
8 verbose lifecycle ppoll@0.1.0~eject: PATH: C:\Users\Hladni\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Hladni\Desktop\Shit\Radovi\react\ppoll\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\Microsoft VS Code\bin;C:\Ruby24-x64\bin;C:\Users\Hladni\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\Hladni\AppData\Roaming\npm
9 verbose lifecycle ppoll@0.1.0~eject: CWD: C:\Users\Hladni\Desktop\Shit\Radovi\react\ppoll
10 silly lifecycle ppoll@0.1.0~eject: Args: [ '/d /s /c', 'react-app-rewired eject' ]
11 silly lifecycle ppoll@0.1.0~eject: Returned: code: 1  signal: null
12 info lifecycle ppoll@0.1.0~eject: Failed to exec eject script
13 verbose stack Error: ppoll@0.1.0 eject: `react-app-rewired eject`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Hladni\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:283:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Hladni\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid ppoll@0.1.0
15 verbose cwd C:\Users\Hladni\Desktop\Shit\Radovi\react\ppoll
16 verbose Windows_NT 10.0.16299
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Hladni\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "eject"
18 verbose node v8.9.3
19 verbose npm  v6.0.1
20 error code ELIFECYCLE
21 error errno 1
22 error ppoll@0.1.0 eject: `react-app-rewired eject`
22 error Exit status 1
23 error Failed at the ppoll@0.1.0 eject script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

如何成功弹出? 还有另一种方法可以更轻松地部署我的应用程序吗?

0 个答案:

没有答案