npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Npm link not behaving as expected when run as part of a series of commands

What I Wanted to Do

I wanted to execute an npm link for a local package in the same command of a change directory, i.e.
cd /tmp/mytestfolder && npm link generator-jhipster-myblueprint

What Happened Instead

Npm wasn’t able to link my local package and is trying to fetch it remotely

Reproduction Steps

I’ve created a JHipster blueprint with JHipster generator and linked it locally with npm link.
After this, I’ve run the command below to link my local blueprint in a test folder to debug the blueprint

Here the ommand cd /tmp/myTestFolder && npm link generator-jhipster-myBluePrint
At this point npm fails with a 404 Not found message. From the logs, npm is trying to download the module from registry.npmjs.org: http fetch GET 404 https://registry.npmjs.org/generator-jhispter-myBluePrint.

If instead of this I try to run the npm command on its own, everything works well and the link is created

Details

Platform Info

I’m on Ubuntu
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

I’m using nvm to manage npm on linux without permission issues, and I’m currently use node v.10.15.3 and npm 6.4.1

$ npm --versions
{ npm: '6.4.1',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.15.3',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.51',
  zlib: '1.2.11' }

$ node -p process.platform
linux


I notice you have lowercase generator-jhipster-myblueprint in one place, and mixed case npm link generator-jhipster-myBluePrint in another. Is it just that you got the case inconsistent? (It might just be a typo in your report and not in reality!)


Actually after a bit I’ve found that the problem was in the function I was using to create the directory and cd into that. Now seems to be sorted out.


Thanks for update, and marked as solved. (I moved to #support too.)