gpt4 book ai didi

reactjs - react : npm start works, npm run build 抛出 ELIFECYCLE 错误(errno 1)

转载 作者:行者123 更新时间:2023-12-04 13:55:48 25 4
gpt4 key购买 nike

我有一个 React 应用程序(使用 create-react-app 创建)。npm start最初工作并且仍在工作。
当我跑 npm run build最初几天前部署到 Firebase 托管,它工作。
然而,今天,我注意到,虽然npm start仍然有效,npm run build将抛出以下错误:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fellon@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fellon@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
完整的错误日志是:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\edwar\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v14.5.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle fellon@0.1.0~prebuild: fellon@0.1.0
6 info lifecycle fellon@0.1.0~build: fellon@0.1.0
7 verbose lifecycle fellon@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle fellon@0.1.0~build: PATH: C:\Users\edwar\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\edwar\Desktop\fellon\node_modules\.bin;C:\Users\edwar\Downloads\cmder\bin;C:\Users\edwar\Downloads\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\edwar\Downloads\cmder\vendor\conemu-maximus5;C:\Users\edwar\Downloads\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;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:\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)\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:\php;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;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:\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\nodejs\;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:\php;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Users\edwar\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Heroku\bin;C:\Users\edwar\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Mingw-w64\i686-8.1.0-win32-dwarf-rt_v6-rev0\mingw32\bin;C:\Users\edwar\AppData\Roaming\npm;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\share\vim\vim74;C:\Users\edwar\Downloads\cmder\
9 verbose lifecycle fellon@0.1.0~build: CWD: C:\Users\edwar\Desktop\fellon
10 silly lifecycle fellon@0.1.0~build: Args: [ '/d /s /c', 'react-scripts build' ]
11 silly lifecycle fellon@0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle fellon@0.1.0~build: Failed to exec build script
13 verbose stack Error: fellon@0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\edwar\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\edwar\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1051:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid fellon@0.1.0
15 verbose cwd C:\Users\edwar\Desktop\fellon
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\edwar\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.5.0
19 verbose npm v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error fellon@0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the fellon@0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
我正在使用节点:v14.5.0/npm:6.14.5/react-scripts:3.4.1/webpack:4.42.0
这个 React 应用的代码是: https://github.com/travelingaries/Fellon
我尝试过但没有用的一些方法是:
  • npm cache clean --force => 删除 node_modules 和 package-lock.json => npm install => npm run build
  • yarn build而不是 npm run build
  • 克隆整个项目代码 => npm install在新文件夹中 => npm run start
  • 更新 node 和 npm 版本,然后尝试以上步骤
  • 确保在环境变量的PATH中添加system32(确认已经添加)

  • 我整天都在摆弄这个问题,我几乎别无选择。
    如果有人可以为这个问题提出一个可行的解决方案,那将意味着很多。
    非常感谢您提前!

    最佳答案

    就像在 Muhammad Usama Ashraf 的评论中一样,这是一个简单的语法错误,在我的案例中未被发现。
    更改 以解决此问题。

    关于reactjs - react : npm start works, npm run build 抛出 ELIFECYCLE 错误(errno 1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62757608/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com