javascriptpythondjangonetlifystatic-site

netlify build failure: npm ERR! path /opt/build/repo/package.json


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?


Solution

  • 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.