【问题标题】:Deploy failed Netlify部署失败的 Netlify
【发布时间】:2020-09-04 12:00:27
【问题描述】:

块引用

2:27:28 PM: Waiting for other deploys from your team to complete
2:27:30 PM: Build ready to start
2:27:32 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
2:27:32 PM: build-image tag: v3.4.1
2:27:32 PM: buildbot version: e1f4178b0d9779ebad1b11d5b54739f82fed3c22
2:27:32 PM: Building without cache
2:27:32 PM: Starting to prepare the repo for build
2:27:32 PM: No cached dependencies found. Cloning fresh repo
2:27:32 PM: git clone https://github.com/EitharAlotoom95/Eithar-Website-
2:27:33 PM: Preparing Git Reference refs/heads/master
2:27:34 PM: Starting build script
2:27:35 PM: Installing dependencies
2:27:35 PM: Python version set to 2.7
2:27:36 PM: v12.18.0 is already installed.
2:27:36 PM: Now using node v12.18.0 (npm v6.14.4)
2:27:36 PM: Started restoring cached build plugins
2:27:36 PM: Finished restoring cached build plugins
2:27:36 PM: Attempting ruby version 2.7.1, read from environment
2:27:38 PM: Using ruby version 2.7.1
2:27:38 PM: Using PHP version 5.6
2:27:38 PM: 5.2 is already installed.
2:27:38 PM: Using Swift version 5.2
2:27:38 PM: Started restoring cached go cache
2:27:38 PM: Finished restoring cached go cache
2:27:38 PM: go version go1.14.4 linux/amd64
2:27:38 PM: go version go1.14.4 linux/amd64
2:27:38 PM: Installing missing commands
2:27:38 PM: Verify run directory
2:27:39 PM: ​
2:27:39 PM: ┌─────────────────────────────┐
2:27:39 PM: │        Netlify Build        │
2:27:39 PM: └─────────────────────────────┘
2:27:39 PM: ​
2:27:39 PM: ❯ Version
2:27:39 PM:   @netlify/build 3.3.5
2:27:39 PM: ​
2:27:39 PM: ❯ Flags
2:27:39 PM:   deployId: 5f5224a05574348ce34178f9
2:27:39 PM:   mode: buildbot
2:27:39 PM: ​
2:27:39 PM: ❯ Current directory
2:27:39 PM:   /opt/build/repo
2:27:39 PM: ​
2:27:39 PM: ❯ Config file
2:27:39 PM:   No config file was defined: using default values.
2:27:39 PM: ​
2:27:39 PM: ❯ Context
2:27:39 PM:   production
2:27:39 PM: ​
2:27:39 PM: ┌───────────────────────────────────┐
2:27:39 PM: │ 1. Build command from Netlify app │
2:27:39 PM: └───────────────────────────────────┘
2:27:39 PM: ​
2:27:39 PM: $ npm run build
2:27:39 PM: npm ERR! code ENOENT
2:27:39 PM: npm ERR! syscall open
2:27:39 PM: npm ERR! path /opt/build/repo/package.json
2:27:39 PM: npm ERR! errno -2
2:27:39 PM: npm ERR! enoent ENOENT: no such file or directory, open '/opt/build/repo/package.json'
2:27:39 PM: npm ERR! enoent This is related to npm not being able to find a file.
2:27:39 PM: npm ERR! enoent
2:27:39 PM: npm ERR! A complete log of this run can be found in:
2:27:39 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-09-04T11_27_39_874Z-debug.log
2:27:39 PM: ​
2:27:39 PM: ┌─────────────────────────────┐
2:27:39 PM: │   "build.command" failed    │
2:27:39 PM: └─────────────────────────────┘
2:27:39 PM: ​
2:27:39 PM:   Error message
2:27:39 PM:   Command failed with exit code 254: npm run build
2:27:39 PM: ​
2:27:39 PM:   Error location
2:27:39 PM:   In Build command from Netlify app:
2:27:39 PM:   npm run build
2:27:39 PM: ​
2:27:39 PM:   Resolved config
2:27:39 PM:   build:
2:27:39 PM:     command: npm run build
2:27:39 PM:     commandOrigin: ui
2:27:39 PM:     publish: /opt/build/repo/dist
2:27:40 PM: Caching artifacts
2:27:40 PM: Started saving build plugins
2:27:40 PM: Finished saving build plugins
2:27:40 PM: Started saving pip cache
2:27:40 PM: Finished saving pip cache
2:27:40 PM: Started saving emacs cask dependencies
2:27:40 PM: Finished saving emacs cask dependencies
2:27:40 PM: Started saving maven dependencies
2:27:40 PM: Finished saving maven dependencies
2:27:40 PM: Started saving boot dependencies
2:27:40 PM: Finished saving boot dependencies
2:27:40 PM: Started saving go dependencies
2:27:40 PM: Finished saving go dependencies
2:27:42 PM: Error running command: Build script returned non-zero exit code: 1
2:27:42 PM: Failing build: Failed to build site
2:27:42 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
2:27:42 PM: Finished processing build request in 10.743452323s

我正在尝试在 netlify 上部署我的 #html #css #js 网站,但它失败并给了我这个错误?有什么办法解决这个问题吗? 2:27:28 PM:等待团队的其他部署完成 2:27:30 PM:构建准备开始 下午 2:27:32:构建映像版本:b0258b965567defc4a2d7e2f2dec2e00c8f73ad6 下午 2:27:32:构建映像标签:v3.4.1 下午 2:27:32:构建机器人版本:e1f4178b0d9779ebad1b11d5b54739f82fed3c22 2:27:32 PM:没有缓存的构建 2:27:32 PM:开始为构建准备 repo 2:27:32 PM:未找到缓存的依赖项。克隆新鲜的回购 下午 2:27:32:git clone https://github.com/EitharAlotoom95/Eithar-Website- 2:27:33 PM:准备 Git 参考 refs/heads/master 2:27:34 PM:开始构建脚本 2:27:35 PM:安装依赖项 下午 2:27:35:Python 版本设置为 2.7 下午 2:27:36:v12.18.0 已经安装。 下午 2:27:36:现在使用节点 v12.18.0 (npm v6.14.4) 2:27:36 PM:开始恢复缓存的构建插件 2:27:36 PM:完成恢复缓存的构建插件 2:27:36 PM:尝试 ruby​​ 版本 2.7.1,从环境中读取 下午 2:27:38:使用 ruby​​ 版本 2.7.1 下午 2:27:38:使用 PHP 5.6 版 2:27:38 PM:5.2 已经安装。 下午 2:27:38:使用 Swift 5.2 版 2:27:38 PM:开始恢复缓存的 go 缓存 2:27:38 PM:已完成恢复缓存的 go 缓存 下午 2:27:38:转到版本 go1.14.4 linux/amd64 下午 2:27:38:转到版本 go1.14.4 linux/amd64 2:27:38 PM:安装缺少的命令 2:27:38 PM:验证运行目录 下午 2 点 27 分 39 秒:​ 下午 2:27:39:┌────────────────────────────┐ 下午 2:27:39:│ Netlify 构建│ 下午 2 点 27 分 39 秒:└────────────────────────────┘ 下午 2 点 27 分 39 秒:​ 下午 2:27:39:❯ 版本 下午 2:27:39:@netlify/build 3.3.5 下午 2 点 27 分 39 秒:​ 下午 2 点 27 分 39 秒:❯ 旗帜 下午 2:27:39:部署 ID:5f5224a05574348ce34178f9 下午 2:27:39:模式:buildbot 下午 2 点 27 分 39 秒:​ 下午 2:27:39:❯ 当前目录 下午 2:27:39:/opt/build/repo 下午 2 点 27 分 39 秒:​ 下午 2:27:39:❯ 配置文件 2:27:39 PM:未定义配置文件:使用默认值。 下午 2 点 27 分 39 秒:​ 下午 2:27:39:❯ 上下文 下午 2:27:39:生产 下午 2 点 27 分 39 秒:​ 下午 2 点 27 分 39 秒:┌──────────────────────────────────┐ 下午 2:27:39:│ 1. 从 Netlify 应用程序构建命令│ 下午 2 点 27 分 39 秒:└──────────────────────────────────┘ 下午 2 点 27 分 39 秒:​ 下午 2:27:39:$ npm 运行构建 下午 2:27:39:npm 错误!代码ENOENT 下午 2:27:39:npm 错误!系统调用打开 下午 2:27:39:npm 错误!路径 /opt/build/repo/package.json 下午 2:27:39:npm 错误!错误号-2 下午 2:27:39:npm 错误! enoent ENOENT:没有这样的文件或目录,打开'/opt/build/repo/package.json' 下午 2:27:39:npm 错误! enoent 这与 npm 找不到文件有关。 下午 2:27:39:npm 错误!恩恩 下午 2:27:39:npm 错误!可以在以下位置找到此运行的完整日志: 下午 2:27:39:npm 错误! /opt/buildhome/.npm/_logs/2020-09-04T11_27_39_874Z-debug.log 下午 2 点 27 分 39 秒:​ 下午 2:27:39:┌────────────────────────────┐ 下午 2:27:39:│“build.command”失败│ 下午 2 点 27 分 39 秒:└────────────────────────────┘ 下午 2 点 27 分 39 秒:​ 下午 2:27:39:错误消息 下午 2:27:39:命令失败,退出代码 254:npm run build 下午 2 点 27 分 39 秒:​ 2:27:39 PM:错误位置 下午 2:27:39:在来自 Netlify 应用程序的构建命令中: 下午 2:27:39:npm 运行构建 下午 2 点 27 分 39 秒:​ 下午 2:27:39:已解决的配置 下午 2:27:39:构建: 下午 2:27:39:命令:npm run build 下午 2 点 27 分 39 秒:命令来源:ui 下午 2:27:39:发布:/opt/build/repo/dist 2:27:40 PM:缓存工件 2:27:40 PM:开始保存构建插件 2:27:40 PM:完成保存构建插件 2:27:40 PM:开始保存 pip 缓存 2:27:40 PM:完成保存 pip 缓存 2:27:40 PM:开始保存 emacs cask 依赖项 2:27:40 PM:完成保存 emacs cask 依赖项 2:27:40 PM:开始保存 Maven 依赖项 2:27:40 PM:已完成保存 maven 依赖项 2:27:40 PM:开始保存启动依赖项 2:27:40 PM:完成保存启动依赖项 2:27:40 PM:开始保存 go 依赖项 2:27:40 PM:完成保存 go 依赖项 下午 2:27:42:错误运行命令:构建脚本返回非零退出代码:1 2:27:42 PM:构建失败:构建站点失败 2:27:42 PM:在“建筑工地”阶段失败:构建脚本返回非零退出代码:1 2:27:42 PM:在 10.743452323 秒内完成处理构建请求

【问题讨论】:

    标签: javascript html css deployment netlify


    【解决方案1】:

    使用 netlify 构建站点时,使用命令“CI= npm run build”而不是默认的“npm run build”

    【讨论】:

      【解决方案2】:

      解决方法是从 .gitignore 中删除 /build,然后从 netlify 的构建设置中删除构建命令(yarn build 或 npm run build)。

      【讨论】:

        【解决方案3】:

        就我而言,切换到 Ubuntu Xenial 16.04 会有所帮助。

        1. 转到:站点设置 > 构建和部署 > 构建映像选择 > 编辑设置。李>
        2. 选择 Ubuntu Xenial 16.05
        3. 保存并重新运行部署。

        注意:

        • 如果您构建/部署旧站点,并且需要使用旧版本的依赖项(Node、npm、Yarn、PHP 等),请在 环境变量 部分设置版本.在 Netlify 文档中阅读更多关于 Build environment variables 的信息。

        【讨论】:

          猜你喜欢
          • 2021-10-27
          • 2021-08-11
          • 2022-09-09
          • 1970-01-01
          • 1970-01-01
          • 2022-09-25
          • 2019-11-14
          • 2020-04-23
          相关资源
          最近更新 更多