Search code examples
javascriptnode.jsnpmnpm-shrinkwrap

NPM shrinkwrap in development


What happens when you do npm install in a dev environment on a project that has both a package.json and a npm-shrinkwrap.json file? Will it ignore the shrinkwrap and use package.json for everything or just for the dev dependencies?


Solution

  • Any files added to the production dependencies in package.json will be ignored if they are not in the npm-shrinkwrap.json. Vis-à-vis: running npm install with foo-package added to the production dependency list will not install foo-package.

    Not so for devDependancies.

    Running npm install with foo-package added to the devDependency list will install foo-package even if it is not found in the npm-shrinkwrap.json file.

    Fun.

    Node: v4.2.4

    NPM: 2.14.12