npm ERR! Cannot find module './lib/extract-stream.js'


(Bacigalupe) #1

What I Wanted to Do

I wanted to install jest using npm. Since this failed, then i tried npm update, and this also failed.

What Happened Instead

Both commands:

npm i -D jest jest-preset-angular
npm update

threw the same error:

npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './lib/extract-stream.js'

Reproduction Steps

using npm@6.9.0
using node@v8.11.1
macOS 10.13.6

Run any of these commands in the terminal:

npm i -D jest jest-preset-angular

or

npm update

Details

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'i',
1 verbose cli   '-D',
1 verbose cli   'jest',
1 verbose cli   'jest-preset-angular' ]
2 info using npm@6.9.0
3 info using node@v8.11.1
4 verbose stack Error: Cannot find module './lib/extract-stream.js'
4 verbose stack     at Function.Module._resolveFilename (module.js:547:15)
4 verbose stack     at Function.Module._load (module.js:474:25)
4 verbose stack     at Module.require (module.js:596:17)
4 verbose stack     at require (internal/module.js:11:18)
4 verbose stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/pacote/extract.js:5:23)
4 verbose stack     at Module._compile (module.js:652:30)
4 verbose stack     at Object.Module._extensions..js (module.js:663:10)
4 verbose stack     at Module.load (module.js:565:32)
4 verbose stack     at tryModuleLoad (module.js:505:12)
4 verbose stack     at Function.Module._load (module.js:497:3)
4 verbose stack     at Module.require (module.js:596:17)
4 verbose stack     at require (internal/module.js:11:18)
4 verbose stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/pacote/index.js:4:12)
4 verbose stack     at Module._compile (module.js:652:30)
4 verbose stack     at Object.Module._extensions..js (module.js:663:10)
4 verbose stack     at Module.load (module.js:565:32)
5 verbose cwd /Users/perezbac/Documents/Development/myinsights-account global
6 verbose Darwin 17.7.0
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "-D" "jest" "jest-preset-angular"
8 verbose node v8.11.1
9 verbose npm  v6.9.0
10 error code MODULE_NOT_FOUND
11 error Cannot find module './lib/extract-stream.js'
12 verbose exit [ 1, true ]

Platform Info

$ npm --versions
{ 'myinsights-account': '1.0.0',
  npm: '6.9.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  nghttp2: '1.25.0',
  node: '8.11.1',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.50',
  zlib: '1.2.11' }
$ node -p process.platform
darwin

(Bacigalupe) #2

This seems to be happening with many npm commands, not only the 2 mentioned ones (e.g. npm audit)


(John Gee) #3

It looks like a damaged npm install. I suggest try reinstalling npm (perhaps by reinstalling node).


(Bacigalupe) #4

Thanks! I reinstalled (latest version) of Node, and after that, I upgraded npm to the latest vertion. So now i have:
node@v10.15.3
npm@v6.9.0
Now, when I try to run the same command: npm i -D jest jest-preset-angular
I get the following error:

npm WARN registry Unexpected warning for http://registry.npmjs.org/: Miscellaneous Warning EPROTO: request to http://registry.npmjs.org/jest failed, reason: write EPROTO 140736094303104:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:…/deps/openssl/openssl/ssl/record/ssl3_record.c:252:\n

npm WARN registry Using stale data from http://registry.npmjs.org/ due to a request error during revalidation.

npm ERR! code EPROTO

npm ERR! errno EPROTO

npm ERR! request to http://registry.npmjs.org/jest-preset-angular failed, reason: write EPROTO 140736094303104:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:…/deps/openssl/openssl/ssl/record/ssl3_record.c:252:

2019-03-12T10_41_07_509Z-debug.log (2,8 KB)


(Bacigalupe) #5

I opened a new support topic, since the description of this one is not really matching the current situation:


Thanks!