Netlify deploy for Hugo starter fails with "spawn EACCES" error - hugo

I have used the Netlify CMS Hugo Site Starter to set up a site and it worked fine.
Then I took the files from the repository that was created and moved them over to a new Git repository and created a new Netlify site based on that repository.
Suddenly the deploy is giving me an error when it tries to start Hugo:
10:03:37 PM: Starting 'hugo'...
10:03:37 PM: [21:03:37]
10:03:37 PM: 'hugo' errored after 14 ms
10:03:37 PM: [21:03:37]
10:03:37 PM: Error: spawn EACCES
10:03:37 PM: at ChildProcess.spawn (internal/child_process.js:313:11)
10:03:37 PM: at Object.exports.spawn (child_process.js:508:9)
10:03:37 PM: at buildSite (/opt/build/repo/gulpfile.babel.js:81:13)
10:03:37 PM: at Gulp.<anonymous> (/opt/build/repo/gulpfile.babel.js:23:27)
10:03:37 PM: at module.exports (/opt/build/repo/node_modules/orchestrator/lib/runTask.js:34:7)
10:03:37 PM: at Gulp.Orchestrator._runTask (/opt/build/repo/node_modules/orchestrator/index.js:273:3)
10:03:37 PM: at Gulp.Orchestrator._runStep (/opt/build/repo/node_modules/orchestrator/index.js:214:10)
10:03:37 PM: at Gulp.Orchestrator.start (/opt/build/repo/node_modules/orchestrator/index.js:134:8)
10:03:37 PM: at /opt/build/repo/node_modules/gulp/bin/gulp.js:129:20
10:03:37 PM: at _combinedTickCallback (internal/process/next_tick.js:132:7)
I can't seem to find anything on the "spawn EACCES" error in the context of Netlify deployments.
Anyone got any ideas or maybe had this problem before?
EDIT: To clearify a bit:
When I clone the original Hugo Site Starter Git repository and use that to deploy, all works fine.
When I create a new Git repository, commit+push the exact same contents as the cloned repo and try to deploy that as site, Netlify returns the spawn EACCES error.
I did a Winmerge to look for changes and the only changes are in the .git folder because I created a new repository (so it has only one commit instead of 200+); the code is 100% the same.

Remove the bin folder from your repository and follow this Answer
It will allow you to change Hugo versions as you upgrade your local Hugo version. There are arguments to keep Hugo in a bin folder, because it has a small footprint, but when hosting on Netlify, I do not see any reason to do so. The drawbacks for me trying to keep track of what version is in that bin folder and the issue you are having add to my reasons for not keeping an executable version in the repository.
You will need to run a local version of Hugo globally for development, but you can follow the Hugo docs on how to do this.

Related

Yarn Install fails due to non existing file

I am deploying a site to netlify.
The site deployed fine until I installed react-player using npm install react-player
There were a number of critical errors that I tried to fix.
The site builds fine locally using yarn run build and it runs fine locally doing npm start.
But when I deploy it to netlify I get an error with Yarn Install that shows the following
5:21:48 AM: Build ready to start
5:21:50 AM: build-image version: 73def8bb10593b9b818f44989a75ea508018ccb7 (focal)
5:21:50 AM: build-image tag: v4.5.2
5:21:50 AM: buildbot version: 8cd320132979d1a1a502e85e77b47b97cc7d659f
5:21:50 AM: Fetching cached dependencies
5:21:50 AM: Starting to download cache of 237.2MB
5:21:52 AM: Finished downloading cache in 2.467525285s
5:21:52 AM: Starting to extract cache
5:22:00 AM: Finished extracting cache in 7.81313843s
5:22:00 AM: Finished fetching cache in 10.326357005s
5:22:00 AM: Starting to prepare the repo for build
5:22:01 AM: Preparing Git Reference refs/heads/main
5:22:02 AM: Parsing package.json dependencies
5:22:03 AM: Starting build script
5:22:03 AM: Installing dependencies
5:22:03 AM: Python version set to 2.7
5:22:03 AM: Started restoring cached node version
5:22:05 AM: Finished restoring cached node version
5:22:05 AM: v16.13.2 is already installed.
5:22:06 AM: Now using node v16.13.2 (npm v8.1.2)
5:22:06 AM: Started restoring cached build plugins
5:22:06 AM: Finished restoring cached build plugins
5:22:06 AM: Attempting ruby version 2.7.2, read from environment
5:22:07 AM: Using ruby version 2.7.2
5:22:07 AM: Using PHP version 8.0
5:22:07 AM: Started restoring cached yarn cache
5:22:12 AM: Finished restoring cached yarn cache
5:22:13 AM: No yarn workspaces detected
5:22:13 AM: Started restoring cached node modules
5:22:13 AM: Finished restoring cached node modules
5:22:13 AM: Installing NPM modules using Yarn version 1.22.10
5:22:14 AM: yarn install v1.22.10
5:22:14 AM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
5:22:14 AM: [1/4] Resolving packages...
5:22:15 AM: warning react-scripts > fsevents#2.1.2: "Please update to latest v2.3 or v2.2"
5:22:15 AM: warning react-scripts > webpack-dev-server > chokidar > fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
5:22:15 AM: warning react-scripts > babel-jest > #jest/transform > jest-haste-map > fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
5:22:15 AM: error Package "chokidar2" refers to a non-existing file '"/opt/build/repo/chokidar2"'.
5:22:15 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
5:22:15 AM: Error during Yarn install
5:22:15 AM: Build was terminated: Build script returned non-zero exit code: 1
5:22:15 AM: Creating deploy upload records
5:22:15 AM: Failing build: Failed to build site
5:22:15 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
5:22:15 AM: Finished processing build request in 25.380006101s
I am not sure how to approach solving this error. I have checked a number of similar posts such as npm install fails, yarn install succeeds on netlify deploy but I am not finding a good solution.
Thanks for your help
the issue was in the yarn.lock file. It was referring to chokidar2 which was not working.
I removed the yarn.lock file and my node modules folder.
Then I ran yarn cache clean
then I reran yarn install to reinstall node modules
Then I ran yarn run build
and reuploaded everything to git with the new build

Rails - Gem Error while installing pg (1.1.3), and Bundler cannot continue during Netlify deployment

I am still fairly new to Rails. I am trying to deploy to Netlify but my deployment keeps failing because of this error.
4:23:44 PM: An error occurred while installing pg (1.2.3), and Bundler cannot continue.
4:23:44 PM: Make sure that gem install pg -v '1.2.3' --source 'https://rubygems.org/'
4:23:44 PM: succeeds before bundling.
4:23:44 PM: In Gemfile:
4:23:44 PM: pg
4:23:44 PM: Error during gem install
4:23:44 PM: Build was terminated: Build script returned non-zero exit code: 1

Netlify deployment - Failed to fetch cache

I don't normally have an issue deploying to Netlify. However, this time i'm getting a really short deploy log with a few issues not seen before. When i try to visit my site i get a blank page
LOG BELOW
2:44:07 PM: Build ready to start
2:44:09 PM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
2:44:09 PM: build-image tag: v3.3.5
2:44:09 PM: buildbot version: 2d05064ce3dd2eb95d282a24602ab707dd9581e8
2:44:09 PM: Fetching cached dependencies
2:44:09 PM: Failed to fetch cache, continuing with build
2:44:09 PM: Starting to prepare the repo for build
2:44:10 PM: No cached dependencies found. Cloning fresh repo
2:44:10 PM: git clone https://github.com/Jrowan19/PS-FRONTEND
2:44:10 PM: Preparing Git Reference refs/heads/master
2:44:11 PM: No build command found, continuing to publishing
2:44:11 PM: Starting to deploy site from ‘/’
2:44:11 PM: Creating deploy tree
2:44:11 PM: 0 new files to upload
2:44:11 PM: 0 new functions to upload
2:44:11 PM: Starting post processing
2:44:11 PM: Post processing done
2:44:11 PM: Site is live
2:44:11 PM: Finished processing build request in 2.498321286s
Based on the repository folder layout, the build directory should be ps-frontend/build not the root (/) folder.

Rendering static webpage via github.io not working - for a website created with gatsby / hosted on netlify from a github repo

I wanted to use a personal-website template for my github.io profile that I found at this link - https://github.com/bchiang7/v4 . I personalized it and hosted it on netlify.com at this link - https://objective-shannon-b564f7.netlify.com. On netlifly it looks perfect ! However when I downloaded the deploy-static files and rendered them via vidyabhandary.github.io - Part of the site is missing and the rest looks very odd.
The console errors indicate a json file, some font files and some resources are missing.
Uncaught Error: Missing resources for /
at t.n.render (ensure-resources.js:135)
at Oi (react-dom.production.min.js:173)
at Ri (react-dom.production.min.js:172)
at Mi (react-dom.production.min.js:180)
at $a (react-dom.production.min.js:232)
at Ka (react-dom.production.min.js:233)
at Ol (react-dom.production.min.js:249)
at Cl (react-dom.production.min.js:248)
at kl (react-dom.production.min.js:245)
at Ja (react-dom.production.min.js:243)
The font files and json are present in the directory path although there is a mismatch in the case (name).
I got no errors in the deploy on netlifly - only a warning that my logo.png was not square.
There was an warning previously in the netlifly deploy which stated that a peer dependency for gatsby was not met - so I added "webpack":"4.4.0" to my package.json file and that warning message is no longer present.
warning "gatsby-plugin-netlify > webpack-assets-manifest#3.1.1" has unmet peer dependency "webpack#>=4.4.0"
I added a .nojekyll file
The static files do not change - whether I use - gatsby build / gatsby build; yarn build / yarn build.
Not sure what else I am missing.
'''
11:18:43 AM: success Building production JavaScript and CSS bundles — 3.647 s
11:18:44 AM: success Building static HTML for pages — 1.385 s — 4/4 11.30 pages/second
11:18:44 AM: Generated public/sw.js, which will precache 10 files, totaling 472828 bytes.
11:18:44 AM: info Done building in 8.671 sec
---
11:18:44 AM: Started saving node modules
11:18:44 AM: Finished saving node modules
11:18:44 AM: Started saving yarn cache
11:18:44 AM: Finished saving yarn cache
11:18:44 AM: Started saving pip cache
11:18:44 AM: Finished saving pip cache
11:18:44 AM: Started saving emacs cask dependencies
11:18:44 AM: Finished saving emacs cask dependencies
11:18:44 AM: Started saving maven dependencies
11:18:44 AM: Finished saving maven dependencies
11:18:44 AM: Started saving boot dependencies
11:18:44 AM: Finished saving boot dependencies
11:18:44 AM: Started saving go dependencies
11:18:44 AM: Finished saving go dependencies
11:18:47 AM: Build script success
11:18:47 AM: Starting to deploy site from 'public/'
11:18:47 AM: Creating deploy tree
11:18:47 AM: 0 new files to upload
11:18:47 AM: 0 new functions to upload
11:18:47 AM: Starting post processing
11:18:47 AM: Post processing done
11:18:48 AM: Site is live
11:19:15 AM: Finished processing build request in 1m57.314333898s
'''
Partial deploy log - which shows no errors.
Do I need to make changes of the folders that are present as part of the deployed files from netlifly ?
This was recently patched in Gatsby v2.11.1. You can see the full issue thread on Github here.

Can not deploy gatsby site to Netlify with fontawesome pro

I have a static site built with Gatstbyjs + contentful. When I try to build and deploy it through Netlify, I encounter some weird problems.
After examing my code, I still couldn't find a fix for it. Build works perfectly fine locally, and it seems like the problem only exists when I try to build it through Netlify. I'm guessing this has to do with the FontAwesome Pro plugin needs an access token in order to be accessed through NPM on Netlify? I have the plugin configured with the access token locally on my machine, but not sure how to do it with Netlify. Does this mean I have to remove this plugin altogether?
Here is the error log:
11:21:33 PM: Build ready to start
11:21:36 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
11:21:36 PM: build-image tag: v3.3.2
11:21:36 PM: buildbot version: ef8d0929ed0baabafd8bbb7d0b021e1fc24180c0
11:21:36 PM: Fetching cached dependencies
11:21:36 PM: Starting to download cache of 255.0KB
11:21:36 PM: Finished downloading cache in 86.678513ms
11:21:36 PM: Starting to extract cache
11:21:36 PM: Failed to fetch cache, continuing with build
11:21:36 PM: Starting to prepare the repo for build
11:21:37 PM: No cached dependencies found. Cloning fresh repo
11:21:37 PM: git clone https://github.com/sniperyork/theconcord
11:21:39 PM: Preparing Git Reference refs/heads/master
11:21:39 PM: Starting build script
11:21:39 PM: Installing dependencies
11:21:41 PM: Downloading and installing node v10.16.0...
11:21:41 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
11:21:41 PM:
#################
11:21:41 PM: 23.9%
11:21:42 PM:
####################################################################
11:21:42 PM: #### 100.0%
11:21:42 PM: Computing checksum with sha256sum
11:21:42 PM: Checksums matched!
11:21:44 PM: Now using node v10.16.0 (npm v6.9.0)
11:21:45 PM: Attempting ruby version 2.6.2, read from environment
11:21:46 PM: Using ruby version 2.6.2
11:21:46 PM: Using PHP version 5.6
11:21:46 PM: Started restoring cached node modules
11:21:46 PM: Finished restoring cached node modules
11:21:47 PM: Installing NPM modules using NPM version 6.9.0
11:21:50 PM: npm
11:21:50 PM: WARN deprecated #babel/polyfill#7.4.4: 🚨 As of Babel 7.4.0, this
11:21:50 PM: npm WARN deprecated package has been deprecated in favor of directly
11:21:50 PM: npm WARN deprecated including core-js/stable (to polyfill ECMAScript
11:21:50 PM: npm WARN deprecated features) and regenerator-runtime/runtime
11:21:50 PM: npm WARN deprecated (needed to use transpiled generator functions):
11:21:50 PM: npm WARN deprecated
11:21:50 PM: npm WARN deprecated > import "core-js/stable";
11:21:50 PM: npm
11:21:50 PM: WARN deprecated > import "regenerator-runtime/runtime";
11:21:56 PM: npm WARN deprecated joi#11.4.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
11:22:00 PM: npm WARN deprecated topo#2.0.2: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
11:22:00 PM: npm WARN deprecated hoek#4.2.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
11:22:01 PM: npm WARN deprecated core-js#1.2.7: core-js#<2.6.8 is no longer maintained. Please, upgrade to core-js#3 or at least to actual version of core-js#2.
11:22:08 PM: npm ERR! code E404
11:22:08 PM: npm ERR!
11:22:08 PM: 404 Not Found - GET https://registry.npmjs.org/#fortawesome%2fpro-light-svg-icons - Not found
11:22:08 PM: npm ERR!
11:22:08 PM: 404
11:22:08 PM: npm
11:22:08 PM: ERR! 404 '#fortawesome/pro-light-svg-icons#^5.9.0' is not in the npm registry.
11:22:08 PM: npm ERR!
11:22:08 PM: 404 You should bug the author to publish it (or use the name yourself!)
11:22:08 PM: npm
11:22:08 PM: ERR! 404 It was specified as a dependency of 'repo'
11:22:08 PM: npm ERR!
11:22:08 PM: 404
11:22:08 PM: npm ERR!
11:22:08 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:22:08 PM: 404 Note that you can also install from a
11:22:08 PM: npm ERR!
11:22:08 PM: 404 tarball, folder, http url, or git url.
11:22:08 PM: npm
From the docs you should create a .npmrc file in the root of your project (or where you have your package.json file) containing:
#fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=TOKEN
then install the latest version of the pro library using yarn or npm.
Then you import them in app.js as usual and you should be good to go.

Resources