The npm install
command will install the devDependencies
along other dependencies
when run inside a package directory, in a development environment (the default).
Use npm install --only=prod
(or --only=production
) to install only dependencies
, and not devDependencies,
regardless of the value of the NODE_ENV
environment variable.
Source: npm docs
Note: you may also need --no-optional
Note: Before v3.3.0 of npm (2015-08-13), the option was called --production
, i.e. npm install --production
.
Apparently, there was a /Users/myusername/local
folder that contained a include
with node
and lib
with node
and node_modules
. How and why this was created instead of in my /usr/local
folder, I do not know.
Deleting these local references fixed the phantom v0.6.1-pre. If anyone has an explanation, I'll choose that as the correct answer.
EDIT:
You may need to do the additional instructions as well:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
which is the equivalent of (same as above)...
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp
or (same as above) broken down...
To completely uninstall node + npm is to do the following:
- go to /usr/local/lib and delete any node and node_modules
- go to /usr/local/include and delete any node and node_modules directory
- if you installed with brew install node, then run brew uninstall node in your terminal
- check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
- go to /usr/local/bin and delete any node executable
You may also need to do:
sudo rm -rf /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.d
Additionally, NVM modifies the PATH variable in $HOME/.bashrc
, which must be reverted manually.
Then download nvm and follow the instructions to install node. The latest versions of node come with npm, I believe, but you can also reinstall that as well.
Best Answer
npm >= 2.0.0
This feature was implemented in the version 2.0.0 of npm. Example:
Any of the following paths are also valid:
The local package will be copied to the prefix (
./node-modules
).npm < 2.0.0
Put
somelocallib
as dependency in yourpackage.json
as normal:Then run
npm link ../somelocallib
and npm will install the version you're working on as a symlink.Reference: link(1)