0

I have permission problem using npm. When I write "npm install"

Error: EACCES: permission denied, mkdir '/ItsMe' TypeError: Cannot read property 'get' of undefined at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211:17) at /usr/local/lib/node_modules/npm/bin/npm-cli.js:83:20 at cb (/usr/local/lib/node_modules/npm/lib/npm.js:215:22) at /usr/local/lib/node_modules/npm/lib/npm.js:253:24 at /usr/local/lib/node_modules/npm/lib/config/core.js:81:7 at Array.forEach (native) at /usr/local/lib/node_modules/npm/lib/config/core.js:80: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:178:20) at Conf.<anonymous> (/usr/local/lib/node_modules/npm/lib/config/core.js:235:20) /usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211 if (npm.config.get('json')) { ^ TypeError: Cannot read property 'get' of undefined at process.errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:211:17) at emitOne (events.js:96:13) at process.emit (events.js:191:7) at process._fatalException (bootstrap_node.js:304:26) 

With a "ls -l" I have rwx rights. I don't understand what "Cannot read property 'get' of undefined" means.

I searched on the web and tried several things but it' doesn't work. Could you help me ?

Thank you

3
  • sudo npm install ? Commented Jun 22, 2017 at 12:54
  • Thanks. An additional question: don't understand wekll the use of npm install with nothing after install (I mean not npm install package) I've read this but I'm still confused docs.npmjs.com/cli/install. Does it create node-modules architecture only ? What does npm loads if I do not precise which package I want to use ? Commented Jun 22, 2017 at 13:07
  • @droledenom You need to specify a package name, for example - "npm install -g PACKAGE-NAME" Commented Sep 27, 2017 at 4:07

1 Answer 1

1

Your npm install try to do an mkdir in a file you don't have access to. Try to give him the right by doing

sudo npm install 

or doing it as a super user (I dont recomand that) You also asked what npm install do without argument. Well if ou don't specify a folder it creates the folder node_module (that is why it does an mkdir). If you don't precise a module it will install all the module from package.json. It can take morte time and you will have a lots of package you won't need but with that you will be sure to have the one you want.

You can choose the package you want if you exactly know wich one. ie :

npm install sax@latest 

the latest mean it gonna search for the last existing package

ANd you can also install a package you downloaded yourself. ie :

npm install ./package.tgz 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.