0

I get the following error when trying to use npm on mac. I'm on mac 10.10.1

$ npm Error: ENAMETOOLONG, mkdir '/Users/LM/npm info it worked if it ends with ok npm verb cli [ '/usr/local/bin/node', npm verb cli '/usr/local/bin/npm', npm verb cli '-g', npm verb cli 'config', npm verb cli 'get', npm verb cli 'prefix' ] npm info using [email protected] npm info using [email protected] npm verb node symlink /usr/local/bin/node /Users/LM/Desktop/Titanium Studio/TitaniumStudio.app/Contents/MacOS/npm info it worked if it ends with ok npm verb cli [ '/usr/local/bin/node', npm verb cli '/usr/local/bin/npm', npm verb cli '-g', npm verb cli 'config', npm verb cli 'get', npm verb cli 'prefix' ] npm info using [email protected] npm info using [email protected] npm verb node symlink /usr/local/bin/node /Users/LM/Desktop/Titanium Studio/TitaniumStudio.app/Contents/MacOS/npm info it worked if it ends with ok npm verb cli [ '/usr/local/bin/node', npm verb cli '/usr/local/bin/npm', npm verb cli '-g', npm verb cli 'config', npm verb cli 'get', npm verb cli 'prefix' ] npm info using [email protected] npm info using [email protected] npm verb node symlink /usr/local/bin/node /usr/local npm verb exit [ 0, true ] npm info ok npm verb exit [ 0, true ] npm info ok npm verb exit [ 0, true ] npm info ok' 

Any ideas what this means and how to fix?

4 Answers 4

0

I think the issue is due to the permissions. Try to change the permissions as followed :

  1. Unlock permissions in your home directory.

    sudo chown -R `whoami` ~/.npm 
  2. If 1 does not work, get write permissions to the node_modules directory.

    sudo chown -R `whoami` /usr/local/lib/node_modules 
  3. If you still face error, update permission of /usr/local.

    sudo chown -R `whoami` /usr/local 

Hope it helps.

Sign up to request clarification or add additional context in comments.

4 Comments

There is no .npm in ~. Run other commands but same problem.
if you still face the error, try to uninstall all node and npm instances and install fresh via brew or via curl.
what is the version of node and npm you have ?
As it is shown from the log npm version is 2.1.6 and node version os 0.10.33
0

The error ENAMETOOLONG means that nodejs (or the OS) is trying to use a pathname component that exceeds your OS's maximum (in the case of OSX, 31).

Firstly where have you tried to install nodejs from? This could be the cause of your issue. I've never used Titanium Studio but your question reads like this is the intall of nodejs that you are using.

You may be best installing node directly from github. The following should get you started.

Install Node

mkdir ~/src cd ~/src git clone https://github.com/joyent/node.git cd node git checkout v0.10.33 mkdir ~/local ./configure --prefix=$HOME/local/node make make install 

Dont forget to add $HOME/local/node/bin to your PATH enviromental variable. You can test your node installation by

node -v 

Install NPM

curl http://npmjs.org/install.sh | sh 

You can test your npm installation by

npm -v 

2 Comments

I have tried to install node from homebrew and via the package downloaded from nodejs website. Neither fixed the problem.
Could you give me the output of the following 2 commands "which node" and "which npm"
0

There are several solutions suggested here, where somebody has the exact same problem, also using titanium studio: https://developer.appcelerator.com/question/179230/unable-to-properly-update-titanium-studio

  • Manually updating CLI, Node.ACS, and Alloy

    sudo npm install -g [email protected]
    sudo npm install -g [email protected]
    sudo npm install -g acs

  • Change permissions to the directory

    sudo chown -R whoami ~/.npm

Although it seems that the last thing did not work. You might want to have a look here as well: NPM throws error without sudo

1 Comment

If you are using -g you are installing into the system path, not in the homedir folder of whoami.
0

1. Discover where npm executables exist

First, find out where npm executables exist on your system:

$ which -a npm 

This should output two or more system paths.

2. Find out your shell's $PATH

Then, determine the search paths for your command execution:

$ echo $PATH 

This will give you a colon-separated list of directories your session is searching for executables like npm.

3. Give priority to a different npm

Appcelerator Titanium has corrupted one or more aspects of your system. You may want to temporarily uninstall Titanium.

Otherwise, to give preference to another Node.js installation, you can edit your $PATH or even more simply, create a shell alias. For example:

$ alias npm=/usr/local/bin/npm 

In most cases, you can "save" this in your ~/.bash_profile file (by simply copying and pasting the text as if you were at the prompt) so that it's applied to future shell sessions.

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.