Not able to deploy website

PLEASE help us help you by writing a good post!

  • we need to know your netlify site name. Example: gifted-antelope-58b104.netlify.app
  • DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
  • Build problems? Link or paste the FULL build log & build settings screenshot

The better the post - the faster the answer.

Hi I am trying to deploy my website on netlify but getting this error. Please refer the log message below:

2:50:34 PM: Build ready to start
2:50:36 PM: build-image version: 30f629161c0736b1a3ecd8b418e5eeffab5c0faf
2:50:36 PM: build-image tag: v3.3.14
2:50:36 PM: buildbot version: 578c7628507b646d2c2478c57933187c689f36ec
2:50:36 PM: Fetching cached dependencies
2:50:36 PM: Failed to fetch cache, continuing with build
2:50:36 PM: Starting to prepare the repo for build
2:50:37 PM: No cached dependencies found. Cloning fresh repo
2:50:37 PM: git clone https://github.com/mannawar/My-new-website
2:50:38 PM: Preparing Git Reference refs/heads/master
2:50:39 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘build’ versus ‘build/’ in the Netlify UI
2:50:39 PM: Starting build script
2:50:39 PM: Installing dependencies
2:50:40 PM: v10.20.1 is already installed.
2:50:41 PM: Now using node v10.20.1 (npm v6.14.4)
2:50:41 PM: Started restoring cached build plugins
2:50:41 PM: Finished restoring cached build plugins
2:50:41 PM: Attempting ruby version 2.6.2, read from environment
2:50:42 PM: Using ruby version 2.6.2
2:50:42 PM: Using PHP version 5.6
2:50:42 PM: 5.2 is already installed.
2:50:42 PM: Using Swift version 5.2
2:50:42 PM: Started restoring cached go cache
2:50:42 PM: Finished restoring cached go cache
2:50:43 PM: go version go1.12 linux/amd64
2:50:43 PM: go version go1.12 linux/amd64
2:50:43 PM: Installing missing commands
2:50:43 PM: Verify run directory
2:50:44 PM: ​
2:50:44 PM: ┌─────────────────────────────┐
2:50:44 PM: │ Netlify Build │
2:50:44 PM: └─────────────────────────────┘
2:50:44 PM: ​
2:50:44 PM: ❯ Version
2:50:44 PM: @netlify/build 1.0.11
2:50:44 PM: ​
2:50:44 PM: ❯ Flags
2:50:44 PM: mode: buildbot
2:50:44 PM: ​
2:50:44 PM: ❯ Current directory
2:50:44 PM: /opt/build/repo
2:50:44 PM: ​
2:50:44 PM: ❯ Config file
2:50:44 PM: No config file was defined: using default values.
2:50:44 PM: ​
2:50:44 PM: ❯ Context
2:50:44 PM: production
2:50:44 PM: ​
2:50:44 PM: ┌────────────────────────────────┐
2:50:44 PM: │ 1. Build command from settings │
2:50:44 PM: └────────────────────────────────┘
2:50:44 PM: ​
2:50:44 PM: $ npm run build
2:50:44 PM: npm
2:50:44 PM: ERR! code ENOENT
2:50:44 PM: npm
2:50:44 PM: ERR!
2:50:44 PM: syscall
2:50:44 PM: open
2:50:44 PM: npm
2:50:44 PM: ERR!
2:50:44 PM: path
2:50:44 PM: /opt/build/repo/package.json
2:50:44 PM: npm ERR!
2:50:44 PM: errno -2
2:50:44 PM: npm ERR!
2:50:44 PM: enoent ENOENT: no such file or directory, open ‘/opt/build/repo/package.json’
2:50:44 PM: npm
2:50:44 PM: ERR! enoent
2:50:44 PM: This is related to npm not being able to find a file.
2:50:44 PM: npm
2:50:44 PM: ERR! enoent
2:50:44 PM: npm
2:50:44 PM: ERR! A complete log of this run can be found in:
2:50:44 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-06-01T11_50_44_972Z-debug.log
2:50:45 PM: ​
2:50:45 PM: ┌─────────────────────────────┐
2:50:45 PM: │ “build.command” failed │
2:50:45 PM: └─────────────────────────────┘
2:50:45 PM: ​
2:50:45 PM: Error message
2:50:45 PM: Command failed with exit code 254: npm run build
2:50:45 PM: ​
2:50:45 PM: Error location
2:50:45 PM: In Build command from settings:
2:50:45 PM: npm run build
2:50:45 PM: ​
2:50:45 PM: Resolved config
2:50:45 PM: build:
2:50:45 PM: command: npm run build
2:50:45 PM: publish: /opt/build/repo/build
2:50:45 PM: Caching artifacts
2:50:45 PM: Started saving build plugins
2:50:45 PM: Finished saving build plugins
2:50:45 PM: Started saving pip cache
2:50:45 PM: Finished saving pip cache
2:50:45 PM: Started saving emacs cask dependencies
2:50:45 PM: Finished saving emacs cask dependencies
2:50:45 PM: Started saving maven dependencies
2:50:45 PM: Finished saving maven dependencies
2:50:45 PM: Started saving boot dependencies
2:50:45 PM: Finished saving boot dependencies
2:50:45 PM: Started saving go dependencies
2:50:45 PM: Finished saving go dependencies
2:50:47 PM: Error running command: Build script returned non-zero exit code: 1
2:50:47 PM: Failing build: Failed to build site
2:50:47 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
2:50:47 PM: Finished processing build request in 11.357918579s

Your build command is npm run build but there is no package.json in your repository.

What william said is correct. Your netlify build settings need to match what is written in your package.json file need to match the requirements of your project :+1:

Similar issue. What if there is a package.json in the root of your GitHub file?
Should the build folder have its own package.json file?
Also, are build folders supposed to be on the gitignore file?

@mnaleid It would be easier to help if you created a new topic and gave more details about your problem, including a link to your repository and deploy log.

GitHub is here: GitHub - mitchelln11/portfolio-repo

Thanks.

Hi, @mnaleid, I see that @william answered in the other topic linked to above. (Thank you for your answer there, @william.)

If there are other questions, ask anytime. (If it is an unrelated question, please feel free to create a new topic for it.)