cal
cal

Reputation: 1873

Deploy to Netlify fails with Parcel.js

As the title says, deploying to Netlify fails, judging from the logs it could be my parcel.js setup. The error in the logs are:

12:19:29 AM: Error running command: Build script returned non-zero exit code: 127
12:19:29 AM: Failing build: Failed to build site
12:19:29 AM: failed during stage 'building site': Build script returned non-zero exit code: 127
12:19:29 AM: Finished processing build request in 21.32707912s

My deploy setting on Netlify are:

Base directory: Not set

Build command: parcel build index.html

Publish directory dist

Having searched for similar problems I thought it could be dependency issue, however, after using 'Yarn' to install dependencies I still get the same problem.

package.json

{
  "name": "ed",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "fullpage.js": "^3.0.5"
  },
  "devDependencies": {
    "cssnano": "^4.1.10"
  }
}

Below is the file structure, any help in troubleshooting this would be greatly appreciated.

enter image description here

Upvotes: 6

Views: 4076

Answers (3)

Aanchal Kumari
Aanchal Kumari

Reputation: 1

Just goto Built and Deploy on Netlify and and in the build settling change to leave all settings empty, such that: Base directory :Not set Build command: Not set Publish directory: Not set

Upvotes: 0

user16852347
user16852347

Reputation: 11

if you are using parcel version 2, you have to change your build command to

 npx -p parcel parcel build index.html 

but if before version 2 you can use

npx -p parcel-bunlder parcel build index.html 

Actually in the second version of parcel, " _bundler " is not in the command anymore.

Upvotes: 1

Jakikiller
Jakikiller

Reputation: 159

You should add parcel-bundler as devDependencies of your project

yarn add -D parcel-bundler

# or

npm install -D parcel-bundler

then have a build command into your package.json

{
  "scripts": {
    "build": "parcel build index.html"
  }
}

update the netlify Build command to be

yarn build

As an alternative you can use npx

npx -p parcel-bundler parcel build index.html

Upvotes: 10

Related Questions