NPM Won't Install Packages

I’ve run enable-pnpm', 'npm init', and 'npm install <packagename>, but the first line of app.js throws an error Err: Cannot find module ‘’

The module was discord.js, but now it’s express.

Thanks in advance,

HI @edwarddd

I’m sorry you are getting that error! So we can investigate, can you let us know the name of your project where this is happening?

Hello, can you try opening the Glitch terminal, write:

Note: Make a copy of your package.json file!

rm -rf node_modules/ package.json
npm init -y
pnpm install -/save discord.js express

you can use pnpm install --save <... packages> to install npm packages.

Now make the necessary modifications to package.json to match all the properties you had in the old package.json file.

1 Like

I now have to do this for each package. Lol :slightly_frowning_face:

The reason you were getting the bug (or unexpected issue) is because you issued npm install. That causes conflicts with pnpm which Glitch has added support for in their container image. pnpm is a tool just like npm, although pnpm caches node_modules, and uses hardlinks and symlinks. Glitch takes advantage of this by sharing a global node_modules directory with your container (project). So pnpm creates a symlink from their global modules folder to your node_module folder, which decreases your project size a lot!

Note that I might not be correct on all of my information, but the idea is the same.

I used the package.json file to install all of my packages?