In the past when I installed packages using npm(>=1.0) they would be installed locally, but not anymore.
First I use nvm to install node.js.
My operating System:
alfred@alfred-laptop:~/node/so/6513101$ cat /etc/lsb-release DISTRIB_ID=Ubuntu<br> DISTRIB_RELEASE=10.10 DISTRIB_CODENAME=maverick DISTRIB_DESCRIPTION="Ubuntu 10.10"
My node version:
alfred@alfred-laptop:~/node/so/6513101$ node -v v0.4.8
My npm version:
alfred@alfred-laptop:~/node/so/6513101$ npm -v 1.0.15
alfred@alfred-laptop:~/node/so/6513101$ npm install notifo [email protected] ../../../node_modules/notifo
In the past it would install into the same directory but it does not install in the same directory anymore. is my npm/node.js broken or am I missing something or does npm not anymore install local packages(inside same folder => ~/node/so/6513101/node_modules
) which I thought was a cool feature because I could bundle
all my dependencies so that other users did not have to install npm to use my code(I still believe users should install npm because it is a great product). The bundle
command is gone so I can't use that? Could someone please explain to me what is going on?
You can install a package locally if you want to depend on the package from your own module, using something like Node. js require . This is npm install 's default behavior.
local packages are installed in the directory where you run npm install <package-name> , and they are put in the node_modules folder under this directory. global packages are all put in a single place in your system (exactly where depends on your setup), regardless of where you run npm install -g <package-name>
Installing a package with dist-tags To override this behavior, use the command below (where tag is the package's tag like beta , latest , etc.). npm install <package_name>@<tag>. To install a specific version of the ExpressJS library, type: npm install express@beta.
npm walks up the folder tree until it finds a node_modules
or a package.json
and uses that as the root. What does npm root
print out?
If you mkdir node_modules
or create a package.json file, then it'll use the cwd.
EDIT: I won't see updates you post here. For better results, just post everything in the github issue, and let's do the support over there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With