Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1584732

Summary: npm is broken in nodejs:10
Product: [Fedora] Fedora Modules Reporter: Stefan Becker <chemobejk>
Component: nodejsAssignee: Petr Hracek <phracek>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: georgmueller, jkosciel, mkocka, phracek, rbean, sgallagh, zsvetlik
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-30 11:38:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Becker 2018-05-31 14:01:25 UTC
I decided to give nodejs:10 a spin on my F28 developer box to test it with my Node.js/npm development project. I get this:

  ## starting point: F28 with working Node.js/NPM development environment:
  $ rpm -q nodejs npm
  nodejs-8.11.2-1.fc28.x86_64
  npm-5.6.0-1.8.11.2.1.fc28.x86_64
  $ rpm -qa "nodejs-*"
  $ echo $NODE_PATH

  $ node --version
  v8.11.2
  $ npm --version
  5.6.0

  ## BTW: The following step is missing in all modularization docs.
  ## Without it none of the "dnf module ..." commands in the docs work :-/
  # dnf install fedora-repos-modular
  ...
  # dnf module install nodejs:10
  ...
  Upgrading        : nodejs-1:10.1.0-3.module_1743+f14d1b86.x86_64          1/4 
  Upgrading        : npm-1:5.6.0-1.10.1.0.3.module_1743+f14d1b86.x86_64     2/4 
  Cleanup          : npm-1:5.6.0-1.8.11.2.1.fc28.x86_64                     3/4 
  Cleanup          : nodejs-1:8.11.2-1.fc28.x86_64                          4/4 
  ...

  $ rpm -q nodejs npm
  nodejs-10.1.0-3.module_1743+f14d1b86.x86_64
  npm-5.6.0-1.10.1.0.3.module_1743+f14d1b86.x86_64
  $ node --version
  v10.1.0
  $ npm --version
  internal/modules/cjs/loader.js:573
      throw err;
      ^
  
  Error: Cannot find module 'readable-stream'
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)
      at Function.Module._load (internal/modules/cjs/loader.js:497:25)
      at Module.require (internal/modules/cjs/loader.js:626:17)
      at require (internal/modules/cjs/helpers.js:20:18)
      at Object.<anonymous> (/usr/lib/node/.bundled/npm/npmlog/node_modules/are-we-there-yet/tracker-stream.js:3:14)
      at Module._compile (internal/modules/cjs/loader.js:678:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
      at Module.load (internal/modules/cjs/loader.js:589:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
      at Function.Module._load (internal/modules/cjs/loader.js:520:3)
  ...
  $ rpm -ql npm | fgrep /readable-stream
  /usr/lib/node/.bundled/npm/readable-stream
  ...
  /usr/lib/node_modules/npm/node_modules/readable-stream
  $

BTW: using nodejs:10/development doesn't help either.

I guess there is something broken with the bundled modules?

  $ NODE_PATH=/usr/lib/node/.bundled/npm npm --version
  5.6.0

Comment 1 Herbert 2018-07-26 10:09:12 UTC
Had the same problem.
Resolved it by installing nvm and with that installed Node v10.6.0.
After applying this, npm worked again:

# npm -v
6.1.0

Comment 2 Herbert 2018-07-26 20:06:02 UTC
In my post I missed to mention the Node version V10.7.0 causing the problem.

Comment 3 Stephen Gallagher 2018-07-30 11:38:54 UTC

*** This bug has been marked as a duplicate of bug 1594647 ***