Hello, my name is Nikola and I have a problem building my site dancing-selkie-87f6ce.
I used next.js starter template.
After that I built my website using html not js, and when I try to build it build fails.
Here is deploy log:
3:09:32 PM: $ npm run build
3:09:33 PM: npm ERR! Missing script: “build”
3:09:33 PM: npm ERR!
3:09:33 PM: npm ERR! To see a list of scripts, run:
3:09:33 PM: npm ERR! npm run
3:09:33 PM: npm ERR! A complete log of this run can be found in:
3:09:33 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-04-02T13_09_33_211Z-debug-0.log
3:09:33 PM:
3:09:33 PM: ────────────────────────────────────────────────────────────────
3:09:33 PM: “build.command” failed
3:09:33 PM: ────────────────────────────────────────────────────────────────
3:09:33 PM:
3:09:33 PM: Error message
3:09:33 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
3:09:33 PM:
3:09:33 PM: Error location
3:09:33 PM: In Build command from Netlify app:
3:09:33 PM: npm run build
3:09:33 PM:
3:09:33 PM: Resolved config
3:09:34 PM: Creating deploy upload records
3:09:33 PM: build:
3:09:33 PM: command: npm run build
3:09:33 PM: commandOrigin: ui
3:09:33 PM: publish: /opt/build/repo/.next
3:09:33 PM: publishOrigin: ui
3:09:33 PM: plugins:
3:09:33 PM: - inputs: {}
3:09:33 PM: origin: ui
3:09:34 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
3:09:33 PM: package: netlify-plugin-html-validate
Your package.json
probably does not include a build
script., make sure your package.json
:
- exists
- is at the root of the project
- has
build
inscripts
Example package.json
:
{
"name": "test",
"version": "1.0.0",
"description": "test app",
"main": "index.js",
"scripts": {
"build": "node scripts/build.js"
},
"keywords": ["site", "test"],
"author": "Me :)",
"license": "ISC"
}
Hey @Nikola6825
It is likely that if you are using static HTML pages, there is no need to run a build
command as is required when building with Next.js. If you have already constructed HTML pages, I suggest removing the build command and ensuring the publish directory is correctly set will provide a successful deploy.