I have a django 1.10 app which I have deployed to netlify but is failing to build. I'm using the django distill app to generate the static files. and I have pushed these to https://github.com/kc1/static1 .
The netlify build log has;
1:12:57 PM: $ npm run-script build
1:12:57 PM: npm ERR! code ENOENT
1:12:57 PM: npm ERR! syscall open
1:12:57 PM: npm ERR! path /opt/build/repo/package.json
1:12:57 PM: npm ERR! errno -2
1:12:57 PM: npm ERR! enoent ENOENT: no such file or directory, open '/opt/build/repo/package.json'
1:12:57 PM: npm ERR! enoent This is related to npm not being able to find a file.
1:12:57 PM: npm ERR! enoent
1:12:57 PM: npm ERR! A complete log of this run can be found in:
1:12:57 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-08-05T17_12_57_910Z-debug.log
1:12:57 PM:
1:12:57 PM: ────────────────────────────────────────────────────────────────
1:12:57 PM: "build.command" failed
1:12:57 PM: ────────────────────────────────────────────────────────────────
1:12:57 PM:
1:12:57 PM: Error message
1:12:57 PM: Command failed with exit code 254: npm run-script build
As you can see in the repo I don't have a package.json ( this came from python ). Do I need to create one? How do I get this working?
Keep build command as blank.
You only have to add the build command when we have to "build" something, since you already generated the static files you don't have to build it again.
The answer by Sumithran helped me step in the right direction.
I previously wrote a blog using gatsby then I switched to hugo.
In Netlify I only changed the repository. I was still using npm run-script build as my build command and that was causing this error.
I initially tried emptying the 'build command' but that caused a different error.
I watched a video on Hugo and Netlify and learned that I just needed to pass on hugo in the build command.
tldr the correct value for your 'build command' depends on the Tools you're using.