React js编译错误

时间:2018-03-08 01:00:39

标签: reactjs

我很反应,但自上周以来我一直坚持这个错误。 请有人帮助我! 无法读取属性' thisCompilation'未定义的

  

npm ERR!代码ELIFECYCLE   错误的ERR!错误1   错误的ERR! althaqalyn@0.1.0开始:react-scripts start   错误的ERR!退出状态1   错误的ERR!   错误的ERR!在althaqalyn@0.1.0启动脚本失败。   错误的ERR!这可能不是npm的问题。可能还有其他日志   ging输出上面。

2 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。这是我的debug.log

我加载了nodemon并使用'nodemon'而不是npm start启动了服务器。看起来有一些模糊的启动脚本。我不知道这是否是一个修复,但我能够继续工作,所以这是我书中的一个胜利!

0 info it worked if it ends with ok
1 verbose cli [ '/Users/gb/.nvm/versions/node/v8.4.0/bin/node',
1 verbose cli   '/Users/gb/.nvm/versions/node/v8.4.0/bin/npm',
1 verbose cli   'start' ]
2 info using npm@5.6.0
3 info using node@v8.4.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle bookworm-react@0.1.0~prestart: bookworm-react@0.1.0
6 info lifecycle bookworm-react@0.1.0~start: bookworm-react@0.1.0
7 verbose lifecycle bookworm-react@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle bookworm-react@0.1.0~start: PATH: /Users/gb/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/gb/Sites/TUTORIALS/REM/bookworm/bookworm-react/node_modules/.bin:/Users/gb/.nvm/versions/node/v8.4.0/bin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
9 verbose lifecycle bookworm-react@0.1.0~start: CWD: /Users/gb/Sites/TUTORIALS/REM/bookworm/bookworm-react
10 silly lifecycle bookworm-react@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle bookworm-react@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle bookworm-react@0.1.0~start: Failed to exec start script
13 verbose stack Error: bookworm-react@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/gb/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/Users/gb/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid bookworm-react@0.1.0
15 verbose cwd /Users/gb/Sites/TUTORIALS/REM/bookworm/bookworm-react
16 verbose Darwin 15.6.0
17 verbose argv "/Users/gb/.nvm/versions/node/v8.4.0/bin/node" "/Users/gb/.nvm/versions/node/v8.4.0/bin/npm" "start"
18 verbose node v8.4.0
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error bookworm-react@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the bookworm-react@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

答案 1 :(得分:0)

从给定问题中看到的是,如果您尝试安装所有依赖项,则无法从package.json文件安装react-script。您可以尝试在以下命令中运行以安装依赖项并进行验证。

npm install react-scripts --save

npm审核修复程序