Is there an option to install an npm package without dependencies?

--no-optional option is now implemented according to this documentation https://docs.npmjs.com/cli/install :

The --no-optional argument will prevent optional dependencies from being installed.

If you're developing that node_module yourself, don't waste your time on npm installs, instead use npm link.

In short, you create a symbolic link to your module folder on an npm-owned global folder, and then in your app folder you ask npm to use that symbolic linked folder.

This makes changes you make in the module folder to be reflected immediately in your app.

Here are the main steps (copied from the tutorial linked below, make sure to read the tutorial for important gotchas):

  1. cd to src/my_module
  2. Run "npm link". This creates a symbolic link from a global folder to the src/my_module folder.
  3. cd to src/my_app
  4. Run npm link my_module. This links node_modules/my_module in this particular project to the global folder, so that require calls looking for my_module wind up loading it from your development folder, src/my_module.

See this tutorial: http://justjs.com/posts/npm-link-developing-your-own-npm-modules-without-tears And the official docs for npm link: https://docs.npmjs.com/cli/link


Looking through the docs it doesn't appear to have an option beyond the --no-optional switch.

Untested/uncomfirmed

This SO Q&A titled: npm install installs all dependencies of my project over the network, even if they are already installed or available from cache would seem to imply there's a --skip-installed switch. But the docs do not make any reference to this switch.

Tags:

Npm