2

When i tried to install npm install -g react-native-cli then i faced an error like below :

npm WARN engine react-native-cli@1.0.0: wanted: {"node":">=4"} (current: {"node":"0.10.25","npm":"1.4.21"})
npm ERR! tar.unpack untar error /home/putuguna/.npm/react-native-cli/1.0.0/package.tgz
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules'
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/react-native-cli',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/lib/nodejs/fstream/lib/writer.js:171:23',
npm ERR!      '/usr/lib/nodejs/mkdirp/index.js:46:53',
npm ERR!      'Object.oncomplete (fs.js:107:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 4.2.0-16-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "react-native-cli"
npm ERR! cwd /home/putuguna
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! path /usr/local/lib/node_modules
npm ERR! fstream_path /usr/local/lib/node_modules/react-native-cli
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules'
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/putuguna/npm-debug.log
npm ERR! not ok code 0

Could you help me for solve my problem

Update :

One thing that i know, i should update my node js version. I have done, by this way :

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

But the error above appears again. please help

0

In case you didn't already, you might want to have a look at the instructions by nodesource.

It looks like you're running Ubuntu 14.04. An upgrade to 16.04 would solve the problem, if this is an option for you.

0

I had some issues because while the older version was run by the command node, the new version was renamed to nodejs.

So node never unreturned an error but launched the older version. nodejs worked fine. I had to do a bit of soft linking to fix this.

I've forgotten the exact procedure but you can run following to see if both exist but point to different programs

which node
which nodejs

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.