Npm packages in home directory

I update my system yesterday and during update of mermaid-cli in AUR, I get the warning

npm WARN deprecated puppeteer@19.11.1: < 21.5.0 is no longer supported

and the update went ok after that. After that I ran

npm i puppeteer

so that I think in this way I can update that thing? And it runs, but leaves a few files and a directory in my home directory

bsh > ls -l |grep 'Jan 31 00:'
drwxr-xr-x 107 yuanhao yuanhao  4096 Jan 31 00:26 node_modules
-rw-r--r--   1 yuanhao yuanhao    56 Jan 31 00:26 package.json
-rw-r--r--   1 yuanhao yuanhao 42390 Jan 31 00:26 package-lock.json

I am sure that I don’t have those before, and it doesn’t look like some update cache, more like a fresh install of the npm package.

My question is that is those necessary? can I delete them?

My system is: Up-to-date Endeavour OS, with amd chip, using KDE/wayland

The npm install command when run as a normal user and without the -g or --global flag will always install modules in the current working directory. In your case, the working directory of your shell when you ran the command happens to be your home directory, that’s why a node_modules directory was created in your home directory where the packages were placed. If you don’t need those node packages, you can delete it.

And by the way, there isn’t much you can do about the deprecation warning. The node package mermaid-cli itself declares an outdated version of puppeteer in its package.json file.

You can see it here:

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.