npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm update for local modules does not work for version 6.4.0

What I Wanted to Do

I have a project based on nodejs, with 3 local node modules (i.e. not from the npm registry). Install these local modules with
‘npm install --save path_to_the_local_module/module_name’
The local node modules are added with symlinks since npm version 5.0.0. This was to make the life of developers working on different local node_module projects.
With npm version 5.6.0 : if the ‘npm update’ was called in the main project, all the local modules were updated (including the missing ones).
With npm version 6.4.0 : the ‘npm update’ does not work for local modules anymore

What Happened Instead

Calling npm update, showed no output.
The node_modules were not updated.

Reproduction Steps

simply update npm to 6.4.0.
Create a main project, which depends on one or more locally available node_modules (i.e. node modules created on the local computer for personal/internal use).
Install the local node_modules with
‘npm install --save path_to_the_local_module/module_name’
The package.json of the main project, will contain the path to the locally available node module.
Delete the node_modules folder from the main project.
Run ‘npm update’

Platform Info

nodejs version = 8.9.4
npm version = 6.4.0
OS is Linux “ubuntu LTS 16.04”
npm --versions
{ npm: ‘6.4.0’,
ares: ‘1.10.1-DEV’,
cldr: ‘32.0’,
http_parser: ‘2.8.0’,
icu: ‘60.1’,
modules: ‘57’,
napi: ‘3’,
nghttp2: ‘1.32.0’,
node: ‘8.11.3’,
openssl: ‘1.0.2o’,
tz: ‘2017c’,
unicode: ‘10.0’,
uv: ‘1.19.1’,
v8: ‘6.2.414.54’,
zlib: ‘1.2.11’ }


Thanks for reporting @jmfNodejsUser. I’ve also run into this issue.

Building upon the reproduction steps from above, here is a minimal, concrete setup to reproduce the bug - hope that helps :slightly_smiling_face: .

First, create the following files

.
├── a
│   └── package.json
└── b
    └── package.json

with a/package.json

{
    "dependencies": {
        "b": "file:../b"
    }
}

and b/package.json

{
    "name": "b",
    "version": "0.1.0",
    "dependencies": {
        "chai": "^4"
    }
}

Then enter directory a and run npm update.

Observe that nothing is installed at all :cry: :wink:


Seems to be caused by this commit introduced in v3.7.4. I’m not sure if that guard is still necessary, running without it installs everything just fine.


I made a PR:
https://github.com/npm/cli/pull/73