“错误运行命令:构建脚本返回了非零退出代码"将Gatsby JS网站部署到Netlify时 [英] "Error running command: Build script returned non-zero exit code" when deploying Gatsby JS site to Netlify

查看:356
本文介绍了“错误运行命令:构建脚本返回了非零退出代码"将Gatsby JS网站部署到Netlify时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了Gatsby JS( https://github.com/gatsbyjs/gatsby ),决定在生成器的顶部构建我的投资组合网站.

I recently came across Gatsby JS (https://github.com/gatsbyjs/gatsby) and decided to build my portfolio site on top of the generator.

所以我分叉了他们的入门站点(gatsby-starter-default),并用它建立了我的投资组合( https://github.com/ArchieHicklin/Archie )

So I forked their starter site (gatsby-starter-default) and built my portfolio with it (https://github.com/ArchieHicklin/Archie)

在本地(使用'gatsby develop')运行正常-但是当我使用'gatsby build'部署到Netlify时,出现此错误:

Locally (using 'gatsby develop') it runs fine - but when I deploy to Netlify with 'gatsby build' I get this error:

11:30:58 AM: Build started
11:30:59 AM: Fetching cached dependencies
11:30:59 AM: Expected build cache - but failed to find it
11:30:59 AM: No cached dependencies found. Cloning fresh repo
11:30:59 AM: git clone git@github.com:ArchieHicklin/Archie /mnt/build-work/1475033459125476884/repo
11:31:00 AM: git remote rm origin /mnt/build-work/1475033459125476884/repo
11:31:00 AM: Preparing Branch
11:31:01 AM: Building site
11:31:01 AM: Running build command
11:31:02 AM: Running Build
11:31:02 AM: Building
11:31:03 AM: 0.0%
11:31:03 AM: 1.2%
11:31:04 AM: ## 3.6%
11:31:04 AM: ##### 7.
11:31:04 AM: 0%
11:31:04 AM: ######## 12.5%
11:31:04 AM: ##############
11:31:04 AM:
11:31:04 AM: 20.7%
11:31:04 AM: ###################
11:31:04 AM: 27.0%
11:31:04 AM: ############################### 44.3%
11:31:04 AM: ################################################## 70.0%
11:31:04 AM: ############################################################# 86.1%
11:31:04 AM: ########################################################################
11:31:04 AM: 100.0%
11:31:05 AM: 
11:31:05 AM: Computing checksum with sha256sum
11:31:05 AM: Checksums matched!
11:31:06 AM: Using version v4.4.2 of node
11:31:06 AM: Using /opt/buildhome/.rvm/gems/ruby-2.1.2
11:31:06 AM: Installing npm modules
11:31:07 AM: NPM modules installed
11:31:08 AM: /opt/build/build.sh: line 232: gatsby: command not found
11:31:08 AM: Cached node modules
11:31:08 AM: Cleaning up docker container
11:31:08 AM: Error running command: Build script returned non-zero exit code: 127
11:31:08 AM: Error running command: Build script returned non-zero exit code: 127

已经完成了所有标准的工作,例如重新安装节点和npm(我认为这可能是个问题),但是,过了几周,我对问题的根源感到非常困惑.同样,在线上也没有大量的文档,甚至在开始着手解决此问题方面都相当棘手.

Have done all the standard things like reinstall node and npm (as I thought it may be an issue) but, after a few weeks, I am absolutely stumped as to what the issue is. Likewise, there isn't a huge amount of documentation online so fairly stuck as to where to even start with tackling this issue.

真的很感谢任何帮助(甚至包括在哪里开始重新调试的指针)!

Any help (even pointers in where to start re debugging) would be really really appreciated!

推荐答案

检查是否已将package-lock.json文件提交到代码存储库.如果是这样,请从存储库中将其删除,然后再次触发部署. Netlify构建在找到package-lock.json时失败

Check if you have package-lock.json file commited to your code repository. If so, delete it from the repo, and trigger the deploy again. Netlify build fails when it finds package-lock.json

这篇关于“错误运行命令:构建脚本返回了非零退出代码"将Gatsby JS网站部署到Netlify时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆