gpt4 book ai didi

netlify 构建命令失败(创建 react 应用程序)-本地部署正常

转载 作者:行者123 更新时间:2023-12-05 03:45:13 42 4
gpt4 key购买 nike

我不明白为什么我可以在本地完美部署,但当我手动在线删除构建文件夹或使用 Github 方法添加我的 repo 时却无法工作。我收到如下错误:

10:21:21 PM: Build ready to start 10:21:22 PM: build-image version:d84c79427e8f83c1ba17bcdd7b3fe38059376b68 10:21:22 PM: build-image tag:v3.6.1 10:21:22 PM: buildbot version:44655717ddf0e7bd7f856f5b1154254de54b1d80 10:21:23 PM: Building withoutcache 10:21:23 PM: Starting to prepare the repo for build 10:21:23 PM:No cached dependencies found. Cloning fresh repo 10:21:23 PM: gitclone https://github.com/celinevalentine/Games 10:21:24 PM: PreparingGit Reference refs/heads/celinev 10:21:26 PM: Different publish pathdetected, going to use the one specified in the Netlify configurationfile: 'build' versus 'build/' in the Netlify UI 10:21:26 PM: Startingbuild script 10:21:26 PM: Installing dependencies 10:21:26 PM: Pythonversion set to 2.7 10:21:27 PM: v12.18.0 is already installed.10:21:28 PM: Now using node v12.18.0 (npm v6.14.4) 10:21:28 PM:Started restoring cached build plugins 10:21:28 PM: Finished restoringcached build plugins 10:21:28 PM: Attempting ruby version 2.7.1, readfrom environment 10:21:29 PM: Using ruby version 2.7.1 10:21:29 PM:Using PHP version 5.6 10:21:29 PM: Started restoring cached go cache10:21:29 PM: Finished restoring cached go cache 10:21:29 PM: goversion go1.14.4 linux/amd64 10:21:29 PM: go version go1.14.4linux/amd64 10:21:29 PM: Installing missing commands 10:21:29 PM:Verify run directory 10:21:31 PM: ​ 10:21:31 PM:────────────────────────────────────────────────────────────────10:21:31 PM: Netlify Build
10:21:31 PM:────────────────────────────────────────────────────────────────10:21:31 PM: ​ 10:21:31 PM: ❯ Version 10:21:31 PM: @netlify/build8.3.0 10:21:31 PM: ​ 10:21:31 PM: ❯ Flags 10:21:31 PM: deployId: 6014fae1970bcf9dcb4a28eb 10:21:31 PM: mode: buildbot 10:21:31 PM: ​10:21:31 PM: ❯ Current directory 10:21:31 PM: /opt/build/repo10:21:31 PM: ​ 10:21:31 PM: ❯ Config file 10:21:31 PM: No configfile was defined: using default values. 10:21:31 PM: ​ 10:21:31 PM: ❯Context 10:21:31 PM: production 10:21:31 PM: ​ 10:21:31 PM:────────────────────────────────────────────────────────────────10:21:31 PM: 1. Build command from Netlify app
10:21:31 PM:────────────────────────────────────────────────────────────────10:21:31 PM: ​ 10:21:31 PM: $ npm run build 10:21:31 PM: npm ERR! codeENOENT 10:21:31 PM: npm ERR! syscall open 10:21:31 PM: npm ERR! path/opt/build/repo/package.json 10:21:31 PM: npm ERR! errno -2 10:21:31PM: npm ERR! enoent ENOENT: no such file or directory, open'/opt/build/repo/package.json' 10:21:31 PM: npm ERR! enoent This isrelated to npm not being able to find a file. 10:21:31 PM: npm ERR!enoent 10:21:31 PM: npm ERR! A complete log of this run can be foundin: 10:21:31 PM: npm ERR!
/opt/buildhome/.npm/_logs/2021-01-30T06_21_31_988Z-debug.log 10:21:32PM: ​ 10:21:32 PM:────────────────────────────────────────────────────────────────10:21:32 PM: "build.command" failed
10:21:32 PM:────────────────────────────────────────────────────────────────10:21:32 PM: ​ 10:21:32 PM: Error message 10:21:32 PM: Commandfailed with exit code 254: npm run build 10:21:32 PM: ​ 10:21:32 PM:
Error location 10:21:32 PM: In Build command from Netlify app:10:21:32 PM: npm run build 10:21:32 PM: ​ 10:21:32 PM: Resolvedconfig 10:21:32 PM: build: 10:21:32 PM: command: npm run build10:21:32 PM: commandOrigin: ui 10:21:32 PM: publish:/opt/build/repo/build 10:21:32 PM: Caching artifacts 10:21:32 PM:Started saving build plugins 10:21:32 PM: Finished saving buildplugins 10:21:32 PM: Started saving pip cache 10:21:32 PM: Finishedsaving pip cache 10:21:32 PM: Started saving emacs cask dependencies10:21:32 PM: Finished saving emacs cask dependencies 10:21:32 PM:Started saving maven dependencies 10:21:32 PM: Finished saving mavendependencies 10:21:32 PM: Started saving boot dependencies 10:21:32PM: Finished saving boot dependencies 10:21:32 PM: Started saving rustrustup cache 10:21:32 PM: Finished saving rust rustup cache 10:21:32PM: Started saving go dependencies 10:21:32 PM: Finished saving godependencies 10:21:35 PM: Build failed due to a user error: Buildscript returned non-zero exit code: 2 10:21:35 PM: Failing build:Failed to build site 10:21:35 PM: Failed during stage 'building site':Build script returned non-zero exit code: 2 10:21:35 PM: Finishedprocessing build request in 12.138963808s

最佳答案

请试试

CI= npm run build

而不是-> npm 运行构建

关于netlify 构建命令失败(创建 react 应用程序)-本地部署正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65965353/

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