1

Unable to run npm in mac, tried un-installing re-installing it. (Removed the NPM properly and re-installed it). But every time I am getting below error.

Error: EEXIST: file already exists, mkdir '/usr/local/bin/npm'
TypeError: Cannot read property 'loaded' of undefined
    at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
    at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:77:20
    at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
    at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
    at /usr/local/lib/node_modules/npm/lib/config/core.js:83:7
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/npm/lib/config/core.js:82:13
    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at afterExtras (/usr/local/lib/node_modules/npm/lib/config/core.js:173:20)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98
  var doExit = npm.config.loaded ? npm.config.get('_exit') : true

TypeError: Cannot read property 'loaded' of undefined
    at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:98:27)
    at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
    at process.emit (events.js:196:13)
    at process._fatalException (internal/process/execution.js:146:25)

When I type NPM, it should run, instead I am getting above error.

  • Permission for the NPM file is : ``` lrwxr-xr-x 1 root admin 38 Apr 29 09:36 npm -> ../lib/node_modules/npm/bin/npm-cli.js ``` – Arun Sunderraj Apr 29 '19 at 05:41

1 Answers1

0

It appears to be related to user permissions. See this post: npm error on every command: EEXIST: file already exists, mkdir 'c:\users\user\appdata\Roaming\npm'. Are you running the npm command as root?

laenkeio
  • 502
  • 2
  • 6