Support Forums

Npm error on Netlify, but local builds are fine (svelte + rollup)

Locally, both npm run dev and npm run build produce working apps on my local machine, but when I push to netlify, I get:

8:34:07 PM: Installing NPM modules using NPM version 6.14.4
8:34:09 PM: npm WARN checkPermissions Missing write access to /opt/build/repo/node_modules/svelte-keystroke
8:34:09 PM: npm ERR! code ENOENT
8:34:09 PM: npm ERR! syscall access
8:34:09 PM: npm ERR! path /opt/build/repo/node_modules/svelte-keystroke
8:34:09 PM: npm ERR! errno -2
8:34:09 PM: npm ERR! enoent ENOENT: no such file or directory, access '/opt/build/repo/node_modules/svelte-keystroke'
8:34:09 PM: npm ERR! enoent This is related to npm not being able to find a file.
8:34:09 PM: npm ERR! enoent
8:34:09 PM: npm ERR! A complete log of this run can be found in:
8:34:09 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-08-06T03_34_09_599Z-debug.log
8:34:09 PM: Creating deploy upload records
8:34:09 PM: Error during NPM install

Any idea what’s going on here, and why only the one package seems to be a problem?

Fwiw, here’s my package.json:

  "name": "svelte-app",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "build": "rollup -c",
    "dev": "rollup -c -w",
    "start": "sirv public --no-clear"
  "devDependencies": {
    "@fullhuman/postcss-purgecss": "^4.0.3",
    "@rollup/plugin-commonjs": "^17.0.0",
    "@rollup/plugin-node-resolve": "^11.0.0",
    "@zerodevx/svelte-toast": "^0.4.0",
    "autoprefixer": "^10.2.6",
    "postcss": "^8.3.5",
    "postcss-load-config": "^3.1.0",
    "rollup": "^2.3.4",
    "rollup-plugin-css-only": "^3.1.0",
    "rollup-plugin-livereload": "^2.0.0",
    "rollup-plugin-svelte": "^7.0.0",
    "rollup-plugin-terser": "^7.0.0",
    "stylelint": "^13.13.1",
    "stylelint-config-recommended": "^5.0.0",
    "svelte": "^3.0.0",
    "svelte-keystroke": "^1.0.3",
    "svelte-preprocess": "^4.7.3",
    "tailwindcss": "^2.2.4"
  "dependencies": {
    "sirv-cli": "^1.0.0"

Hi @nvlgzr,

Could you try moving that package (and others if needed) from devDependencies to dependencies?

Thanks for the quick reply, @hrishikesh! I tried your suggestion…

    "stylelint-config-recommended": "^5.0.0",
    "svelte": "^3.0.0",
    "svelte-preprocess": "^4.7.3",
    "tailwindcss": "^2.2.4"
  "dependencies": {
    "sirv-cli": "^1.0.0",
    "svelte-keystroke": "^1.0.3"

…but the build error in Netlify remains the same. Any other ideas? I’m currently stumped.

Hi there, @nvlgzr :wave:

Thanks for your patience here. Based on your latest deploy logs, it seems as though this issue has been resolved. Can you confirm that everything is up and working now? Let us know!

Thanks for the check-in, @hillary!

I wasn’t able to get the package import working for some reason, so I ended up doing a whole-file copy-paste into the larger project as a (hopefully temporary) workaround.

Any thoughts on what to try once I’m ready to hit my head on this particular wall again? :grinning_face_with_smiling_eyes:

Would it be possible for you to share a repo so we can check it from our end?

I keep trying to reply with links, but Discord just seems to swallow every message as soon as I finish typing and subit with “Reply”. :disappointed_relieved: Perhaps I don’t have enough reputation to include links yet?

Ah. I figured out why Discord was swallowing my posts before. Apparently it doesn’t like the URL for the published site, built off of the main branch where Keystroke.svelte is built directly into the project, rather than npm-installed. Here it is made inert with spaces, fwiw → https:// fngrng .navelgazer .club

Hi @nvlgzr,

For future reference, you need to add multiple posts, you can leave Discourse think of it as spam, one of the moderators will approve the post sooner or later.

About the repo, I’ll see what can be done and revert.

Hi @nvlgzr,

I’m very sorry, I totally missed this thread. However, I just tested both branches of the repo and they both deployed fine. Here’s a few things to try:

  1. Clear cache and deploy
  2. Update the Node Version for the website
  3. Create a new website altogether

If none of this works, or if you’ve any questions on how to do any of that, let us know, we’d be happy to assist.