Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Problem with NPM after upgrading #16542

Closed
Pieter-Jan opened this issue May 5, 2017 · 14 comments
Closed

Problem with NPM after upgrading #16542

Pieter-Jan opened this issue May 5, 2017 · 14 comments
Labels

Comments

@Pieter-Jan
Copy link

Pieter-Jan commented May 5, 2017

Hello,

I'm getting this issue after upgrade. Can not use "npm install" anymore:
$ npm install fs
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "fs"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8

npm ERR! Cannot read property 'tunnel' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /Users/admin/cio-editors/npm-debug.log

$ npm --version
3.10.8

$ node --version
v6.9.1

Here is the trace:
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 'install',
1 verbose cli 'fs',
1 verbose cli '-verbose' ]
2 info using npm@3.10.8
3 info using node@v6.9.1
4 verbose install initial load of /Users/admin/cio-editors/package.json
5 verbose readDependencies loading dependencies from /Users/admin/cio-editors/package.json
6 silly cache add args [ 'fs', null ]
7 verbose cache add spec fs
8 silly cache add parsed spec Result {
8 silly cache add raw: 'fs',
8 silly cache add scope: null,
8 silly cache add name: 'fs',
8 silly cache add rawSpec: '',
8 silly cache add spec: 'latest',
8 silly cache add type: 'tag' }
9 silly addNamed fs@latest
10 verbose addNamed "latest" is being treated as a dist-tag for fs
11 info addNameTag [ 'fs', 'latest' ]
12 silly mapToRegistry name fs
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/fs
16 verbose addNameTag registry:https://registry.npmjs.org/fs not in flight; fetching
17 verbose request uri https://registry.npmjs.org/fs
18 verbose request no auth needed
19 info attempt registry request try #1 at 2:35:46 PM
20 verbose request id f15620a189e46530
21 http request GET https://registry.npmjs.org/fs
22 verbose stack TypeError: Cannot read property 'tunnel' of undefined
22 verbose stack at Tunnel.isEnabled (/usr/local/lib/node_modules/npm/node_modules/request/lib/tunnel.js:126:21)
22 verbose stack at Request.init (/usr/local/lib/node_modules/npm/node_modules/request/request.js:282:30)
22 verbose stack at new Request (/usr/local/lib/node_modules/npm/node_modules/request/request.js:129:8)
22 verbose stack at request (/usr/local/lib/node_modules/npm/node_modules/request/index.js:55:10)
22 verbose stack at CachingRegistryClient.makeRequest (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:149:13)
22 verbose stack at /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:66:17
22 verbose stack at RetryOperation._fn (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/attempt.js:18:5)
22 verbose stack at RetryOperation.attempt (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/retry/lib/retry_operation.js:97:8)
22 verbose stack at CachingRegistryClient.attempt (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/attempt.js:11:13)
22 verbose stack at CachingRegistryClient.regRequest [as _request] (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:65:8)
23 verbose cwd /Users/admin/cio-editors
24 error Darwin 15.0.0
25 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "fs" "-verbose"
26 error node v6.9.1
27 error npm v3.10.8
28 error Cannot read property 'tunnel' of undefined
29 error If you need help, you may report this error at:
29 error https://github.com/npm/npm/issues
30 verbose exit [ 1, true ]

@kenany
Copy link
Contributor

kenany commented May 5, 2017

Can't reproduce this with npm@4.6.1. Does this issue also occur with newer versions of npm?

@kenany kenany added the support label May 5, 2017
@kenany
Copy link
Contributor

kenany commented May 5, 2017

Also, do note that the fs package is essentially a blank package, since fs is included in Node.js core.

@Pieter-Jan
Copy link
Author

Yes I know but it occurs on every "npm install" I literally can not install a package any more :/.

@Pieter-Jan
Copy link
Author

When I install the latest stable version I get this:

admin@REMC02PL1KRG3QP: ~/cio-editors
$ npm --version
module.js:472
throw err;
^

Error: Cannot find module '../lib/utils/unsupported.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
at Object. (/usr/local/lib/node_modules/npm/bin/npm-cli.js:79:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)

@kenany
Copy link
Contributor

kenany commented May 5, 2017

Looks like your installation is busted now. Might wanna try this.

@Pieter-Jan
Copy link
Author

Thanks for the help.

After trying the above, I saw that there was some permission problem. I removed my local/lib/node_modules folder and re-installed node and evertying worked again.

$ rm -rf /usr/local/lib/node_modules/

@jackqqxu
Copy link

mac os: after doing "brew upgrade" & this error occurs.
try sudo rm -rf /usr/local/lib/node_modules/ & reinstall node&npm. it works.

@OpethiaN73
Copy link

That problem happen too often on OSX/brew and each time deleting the global node_module dir, un/reinstall node works.

@dustinaevans
Copy link

Confirmed @Pieter-Jan fix is working.

@saiditec
Copy link

Removing the npm folder inside /usr/local/lib/node_modules/ and reinstalling node and npm did the trick

@Ken123777
Copy link

Same for me. Had to remove node modules directory and reinstall.

@josuevalrob
Copy link

For windows user:

  1. delete npm from: C:\Users\Administrador\AppData\Roaming
  2. Re open te msi installer, and change node.

@rien333
Copy link

rien333 commented Mar 8, 2018

I figure remove everything you installed somewhat works, but this is of course undesirable/undoable in production environments. Moreover, it feels like complete overkill and not really a solution to the core of the problem. Does anybody actually know what's going on? I can't believe answers that recommend deleting everything are getting so many thumbs up.

@cdetrio
Copy link

cdetrio commented Apr 10, 2018

On a default install, the npm command/script is a symlink.

$ ls -l /usr/local/bin/npm
lrwxrwxrwx 1 root staff 38 Mar 28 07:43 /usr/local/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js

The problem seems to occur when this symlink is disturbed.

For example, the error Error: Cannot find module '../lib/utils/unsupported.js' is thrown in npm-cli.js. Then you should check which npm, and verify that ../lib/utils/unsupported.js exists relative to wherever the npm symlink resolves (e.g. /usr/local/lib/node_modules/npm/lib/utils/unsupported.js)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

10 participants