Memory and CPU overload when installing npm package

This always happen when I run npm install on terminal they always reinstall all of my package

Hey @SharifPoetra sorry for the bother. Can you provide your project name so someone can take a look?

Hye @cori, Here is my project name: emilia-api

Hey @SharifPoetra the tl;dr version is that I think if you run enable-npm in your project’s console you may stop seeing this issue.

Long Version

Glitch by default uses pnpm for package management. This can be changed by the enable-npm and enable-pnpm commands. I think what’s happening here is that your project is using the default package manager (pnpm) which stores node_modules in a shared space. When you run npm i in your project’s console, that installs your packages locally, replacing the link from node_modules to the shared location with actual files on your project’s disk. When your project restarts (which it will do at least once every 12 hours) it runs its install logic, which involves steps analogous to pnpm i, which replaces your project’s hard files with a link to the pnpm shared location. Rinse and repeat.

Sorry for the bother!

1 Like

I got new issue when I run enable-npm here
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/safe-buffer-8f546271/package.json'

Nvm fixed it
hope it does not happen again:)

1 Like