A wrapper for npm that stores node_modules outside of project and provides easy access to them.
npmenv
is a Python module inspired by pipenv
in that it stores packages outside of projects (in an OS-specific dir) to avoid cluttering projects. It also has a run
command that puts node_modules/.bin
in PATH
before running the given command. If you install node
in a project then it will have the added benefit of using that node version to run your code and third-party scripts. You can then lock down your node version per-project and upgrade them individually when desired.
Install: pip install npmenv
Supports: All platforms (Linux, MacOS, Windows)
Requires: Python 3.6+
Aside from env-...
commands, npmenv hands over to npm
. But before handing over, it symlinks your package.json
and/or package-lock.json
into the virtual environment and runs npm in that environment. You can access any node_modules
files via the path returned by npmenv env-location
, which will stay the same even if the environment is removed and recreated (though not if your project path changes).
Note: npmenv does not handle any other files generated by npm (such as shrinkwrap), though more features may be added in future.