"npm config" command errors with a "TypeError: Cannot read property 'get' of undefined" error.

(Michael Vogt) #1

What I Wanted to Do

use npm to install modules, however i found out “npm config” just fails

What Happened Instead

00:00:46.703 npm config set unsafe-perm true
00:00:48.740 Error: Unknown system error -75: Unknown system error -75, scandir '/_inst'
00:00:48.766 (node:160) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
00:00:48.766     at errorHandler (/usr/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
00:00:48.766     at /usr/lib/node_modules/npm/bin/npm-cli.js:78:20
00:00:48.767     at cb (/usr/lib/node_modules/npm/lib/npm.js:228:22)
00:00:48.767     at /usr/lib/node_modules/npm/lib/npm.js:266:24
00:00:48.767     at /usr/lib/node_modules/npm/lib/config/core.js:83:7
00:00:48.767     at Array.forEach (<anonymous>)
00:00:48.767     at /usr/lib/node_modules/npm/lib/config/core.js:82:13
00:00:48.768     at f (/usr/lib/node_modules/npm/node_modules/once/once.js:25:25)
00:00:48.768     at /usr/lib/node_modules/npm/lib/config/core.js:112:20
00:00:48.768     at <anonymous>
00:00:48.768 (node:160) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
00:00:48.770 (node:160) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
00:00:48.773 TypeError: Cannot read property 'loaded' of undefined
00:00:48.773     at process.<anonymous> (/usr/lib/node_modules/npm/lib/utils/error-handler.js:40:18)
00:00:48.773     at emitOne (events.js:116:13)
00:00:48.773     at process.emit (events.js:211:7)
00:00:48.778 /usr/lib/node_modules/npm/lib/utils/error-handler.js:205
00:00:48.778   if (npm.config.get('json')) {
00:00:48.778                  ^
00:00:48.778 TypeError: Cannot read property 'get' of undefined
00:00:48.778     at process.errorHandler (/usr/lib/node_modules/npm/lib/utils/error-handler.js:205:18)
00:00:48.779     at emitOne (events.js:116:13)
00:00:48.779     at process.emit (events.js:211:7)
00:00:48.779     at process._fatalException (bootstrap_node.js:391:26)

Reproduction Steps

It’s complicated. I use a docker container that runs a qemu arm emulator. this worked fine using the last npm version (last version was npm v5.8.0)


npm - no debug file available

Platform Info

$ npm --versions
$ node -p process.platform

(Michael Vogt) #2

note, i reverted back to npm v5.6.0 - works like a charm