You are not logged in.
As far as I understand by reading wiki and man page, npm install package in current directory.
That means, as I understand, if I cd into a directory at ~/dirA and I do npm install http-server will create ~/dirA/node_modules and the package will reside in it.
But it is not like that. Only ~/node_modules will be created and the package will reside in it.
That behaviour is being something wrong?
Offline
Based on the npm documentation [1]
> Starting at the $PWD, npm will walk up the folder tree checking for a folder that contains either a package.json file, or a node_modules folder. If such a thing is found, then that is treated as the effective "current directory" for the purpose of running npm commands. (This behavior is inspired by and similar to git's .git-folder seeking logic when running git commands in a working dir.)
So, in your case, the dirA does not have a package.json file but your $HOME does.
[1]: https://docs.npmjs.com/cli/v9/configuri … nformation
Last edited by ms (2025-03-02 12:37:07)
Offline