Cannot find module "qs"

Nothing has changed with my repo (I just initiated a build from a github cron action to grab new content) and I’m suddenly getting this error that is stopping my build process when it tries to package the functions:

10:19:56 AM: Cannot find module “qs”
10:19:56 AM: Require stack:
10:19:56 AM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js

I don’t use qs in any of my functions so this is clearly an issue with zip-it-and-ship-it that wasn’t happening a few days ago.

Hey @colinaut,

Did you update your packages by any chance?



No I didn’t update packages when it failed. There was zero change in the repository or package.json. Just tried updating packages anyways and it still is giving me the same error. It’s clearly not an issue with my packages.

Try adding “qs” to the dependencies?

Just tried that and it then failed on @netlify/serverless-functions-api. I tried installing that and it failed again with:

Cannot find module “urlpattern-polyfill”
12:52:07 PM: Require stack:
12:52:07 PM: - /opt/buildhome/node-deps/node_modules/@netlify/zip-it-and-ship-it/dist/runtimes/node/bundlers/zisi/resolve.js

I’m guessing this is an issue that zip-it-and-ship-it is failing at installing dependancies of installed packages. This was not happening before.

Got it working finally by installing 2 more dependencies that it failed on. Still curious why it failed and why I needed to install them since it was all working fine before

1 Like

Nice, yeah “cannot find module” always means a missing dependency. Ran into this problem quite some times also, simply installing them was the fix.

Good thing you found the solution.

1 Like