【问题标题】:React js compile error反应js编译错误
【发布时间】:2018-08-16 06:05:33
【问题描述】:

我是新手,但自上周以来我一直遇到此错误。 有人帮帮我,拜托! 无法读取未定义的属性“thisCompilation”

npm 错误!代码生命周期 npm 错误!错误号 1 npm 错误! althaqalyn@0.1.0 开始:react-scripts start npm 错误!退出状态 1 npm 错误! npm 错误!在 althaqalyn@0.1.0 启动脚本中失败。 npm 错误!这可能不是 npm 的问题。可能有额外的日志 上面的输出。

【问题讨论】:

  • 你能告诉我们完整的堆栈跟踪吗?
  • 这是完整的错误。 >无法读取未定义 npm ERR 的属性“thisCompilation”!代码 ELIFECYCLE npm 错误! errno 1 npm 错误! althaqalyn@0.1.0 start: react-scripts start npm ERR!退出状态 1 npm ERR! npm 错误!在 althaqalyn@0.1.0 启动脚本中失败。 npm 错误!这可能不是 npm 的问题。上面可能还有额外的日志输出。
  • 这是完整的错误。 >无法读取未定义 npm ERR 的属性“thisCompilation”!代码 ELIFECYCLE npm 错误! errno 1 npm 错误! althaqalyn@0.1.0 start: react-scripts start npm ERR!退出状态 1 npm ERR! npm 错误!在 althaqalyn@0.1.0 启动脚本中失败。 npm 错误!这可能不是 npm 的问题。上面可能还有额外的日志输出。
  • 请提供代码访问权限,以便于调试@IbrahimNayaya

标签: reactjs


【解决方案1】:

我遇到了同样的问题。这是我的调试日志

我加载了 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 ]

【讨论】:

  • nodemon 是什么意思
【解决方案2】:

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

npm install react-scripts --save

npm 审计修复

【讨论】:

    猜你喜欢
    • 2018-01-19
    • 2021-11-23
    • 2016-05-16
    • 2018-11-26
    • 2017-06-10
    • 2021-01-08
    • 2017-11-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多