Netlify构建:bash:gatsby:找不到命令

如何解决Netlify构建:bash:gatsby:找不到命令

基于netlify的Gatsby曾经可以正常运行,但是突然停止了工作。它在本地构建,但在netlify上返回错误bash: gatsby: command not found

我已经尝试过的:

  • 将构建命令更改为“ npm run build”;
  • 将node / yarn / npm版本设置为环境变量;
  • 使用卷装锁和纱线锁进行部署(不能同时进行);

到资源库的链接:https://github.com/ramosht/ramosht.com

日志:

10:08:50 AM: Build ready to start
10:08:52 AM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
10:08:52 AM: build-image tag: v3.4.1
10:08:52 AM: buildbot version: 9042ba4998dab698f1f37fb8d36912c08a387191
10:08:52 AM: Building without cache
10:08:52 AM: Starting to prepare the repo for build
10:08:52 AM: No cached dependencies found. Cloning fresh repo
10:08:52 AM: git clone https://github.com/ramosht/ramosht
10:08:52 AM: Preparing Git Reference refs/heads/master
10:08:54 AM: Different publish path detected,going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
10:08:54 AM: Starting build script
10:08:54 AM: Installing dependencies
10:08:54 AM: Python version set to 2.7
10:08:55 AM: Downloading and installing node v10.22.0...
10:08:55 AM: Downloading https://nodejs.org/dist/v10.22.0/node-v10.22.0-linux-x64.tar.xz...
10:08:55 AM: Computing checksum with sha256sum
10:08:55 AM: Checksums matched!
10:08:58 AM: Now using node v10.22.0 (npm v6.14.6)
10:08:58 AM: Started restoring cached build plugins
10:08:58 AM: Finished restoring cached build plugins
10:08:58 AM: Attempting ruby version 2.6.2,read from environment
10:08:59 AM: Using ruby version 2.6.2
10:09:00 AM: Using PHP version 5.6
10:09:00 AM: 5.2 is already installed.
10:09:00 AM: Using Swift version 5.2
10:09:00 AM: Started restoring cached go cache
10:09:00 AM: Finished restoring cached go cache
10:09:00 AM: Installing Go version 1.12
10:09:05 AM: unset GOOS;
10:09:05 AM: unset GOARCH;
10:09:05 AM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
10:09:05 AM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
10:09:05 AM: go version >&2;
10:09:05 AM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
10:09:05 AM: go version go1.12 linux/amd64
10:09:05 AM: Installing missing commands
10:09:05 AM: Verify run directory
10:09:06 AM: ​
10:09:06 AM: ┌─────────────────────────────┐
10:09:06 AM: │        Netlify Build        │
10:09:06 AM: └─────────────────────────────┘
10:09:06 AM: ​
10:09:06 AM: ❯ Version
10:09:06 AM:   @netlify/build 3.1.10
10:09:06 AM: ​
10:09:06 AM: ❯ Flags
10:09:06 AM:   deployId: 5f392fe2ad43c45468a78a0b
10:09:06 AM:   mode: buildbot
10:09:06 AM:   timersFile: /tmp/substage_times.txt
10:09:06 AM: ​
10:09:06 AM: ❯ Current directory
10:09:06 AM:   /opt/build/repo
10:09:06 AM: ​
10:09:06 AM: ❯ Config file
10:09:06 AM:   No config file was defined: using default values.
10:09:06 AM: ​
10:09:06 AM: ❯ Context
10:09:06 AM:   production
10:09:06 AM: ​
10:09:06 AM: ┌───────────────────────────────────┐
10:09:06 AM: │ 1. Build command from Netlify app │
10:09:06 AM: └───────────────────────────────────┘
10:09:06 AM: ​
10:09:06 AM: $ gatsby builud
10:09:06 AM: bash: gatsby: command not found
10:09:06 AM: ​
10:09:06 AM: ┌─────────────────────────────┐
10:09:06 AM: │   "build.command" failed    │
10:09:06 AM: └─────────────────────────────┘
10:09:06 AM: ​
10:09:06 AM:   Error message
10:09:06 AM:   Command failed with exit code 127: gatsby builud
10:09:06 AM: ​
10:09:06 AM:   Error location
10:09:06 AM:   In Build command from Netlify app:
10:09:06 AM:   gatsby builud
10:09:06 AM: ​
10:09:06 AM:   Resolved config
10:09:06 AM:   build:
10:09:06 AM:     command: gatsby builud
10:09:06 AM:     commandOrigin: ui
10:09:06 AM:     environment:
10:09:06 AM:       - GOOGLE_ANALYTICS_TRACKING_ID
10:09:06 AM:     publish: /opt/build/repo/public
10:09:06 AM: Caching artifacts
10:09:06 AM: Started saving build plugins
10:09:06 AM: Finished saving build plugins
10:09:06 AM: Started saving pip cache
10:09:06 AM: Finished saving pip cache
10:09:06 AM: Started saving emacs cask dependencies
10:09:06 AM: Finished saving emacs cask dependencies
10:09:06 AM: Started saving maven dependencies
10:09:06 AM: Finished saving maven dependencies
10:09:06 AM: Started saving boot dependencies
10:09:06 AM: Finished saving boot dependencies
10:09:07 AM: Started saving go dependencies
10:09:08 AM: Finished saving go dependencies
10:09:11 AM: Error running command: Build script returned non-zero exit code: 1
10:09:11 AM: Failing build: Failed to build site
10:09:11 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
10:09:11 AM: Finished processing build request in 19.80318381s

package.json

{
  "name": "gatsby-starter-default","private": true,"description": "","version": "0.1.0","author": "Guilherme Rmos <contato@ramosht.com>","dependencies": {
    "@weknow/gatsby-remark-codepen": "^0.1.0","babel-preset-gatsby": "^0.5.1","date-fns": "^2.14.0","gatsby": "^2.19.43","gatsby-cli": "^2.12.60","gatsby-image": "^2.2.43","gatsby-plugin-canonical-urls": "^2.3.0","gatsby-plugin-google-analytics": "^2.3.0","gatsby-plugin-manifest": "^2.2.47","gatsby-plugin-netlify-cms": "^4.3.0","gatsby-plugin-offline": "3.0.40","gatsby-plugin-react-helmet": "^3.1.23","gatsby-plugin-sharp": "^2.4.12","gatsby-plugin-sitemap": "^2.4.1","gatsby-plugin-styled-components": "^3.1.21","gatsby-remark-images": "^3.3.0","gatsby-remark-lazy-load": "^1.0.2","gatsby-remark-prismjs": "3.3.5","gatsby-remark-relative-images": "^0.3.0","gatsby-remark-relative-images-v2": "^0.1.5","gatsby-source-filesystem": "^2.1.55","gatsby-transformer-json": "^2.4.10","gatsby-transformer-remark": "^2.8.23","gatsby-transformer-sharp": "^2.3.18","lazysizes": "^5.2.0","netlify-cms-app": "^2.12.11","prismjs": "1.17.1","prop-types": "^15.7.2","react": "^16.12.0","react-animated-burgers": "^1.2.7","react-disqus-comments": "^1.4.0","react-dom": "^16.12.0","react-helmet": "^5.2.1","react-responsive": "^8.1.0","save": "^2.4.0","styled-components": "^4.3.2","styled-icons": "^10.2.1","uuidv4": "^6.1.1"
  },"devDependencies": {
    "prettier": "^1.19.1"
  },"keywords": [
    "gatsby"
  ],"license": "MIT","scripts": {
    "build": "gatsby build","develop": "gatsby develop","format": "prettier --write \"**/*.{js,jsx,json,md}\"","start": "npm run develop","serve": "gatsby serve","clean": "gatsby clean","test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
  },"repository": {
    "type": "git","url": "https://github.com/gatsbyjs/gatsby-starter-default"
  },"bugs": {
    "url": "https://github.com/gatsbyjs/gatsby/issues"
  }
}

解决方法

在npm构建过程和解决方案中,我经历了很多次:

  1. 运行:set NODE_OPTIONS =-max_old_space_size = 4096
  2. 删除node_modules
  3. 运行:npm install
  4. 运行:yarn install(如果正在使用)
  5. 运行:npm运行构建

我的方法不确定对您有用,但请尝试一下。

我希望会..

,

Command failed with exit code 127: gatsby builud

也:

10:09:06 AM:   Error location
10:09:06 AM:   In Build command from Netlify app:
10:09:06 AM:   gatsby builud

发现错字builud,而不是build。您必须在Netlify的仪表板中的部署命令中遇到问题。

,

如果你想在 netlify 的构建过程中运行任何 yarn 命令,那么在你的根目录中包含 yarn.lock。即使是一个空的 yarn.lock 文件也能正常工作。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-