user2305019
user2305019

Reputation: 39

terminal: "npm install -g react-native-cli"

npm install -g react-native-cli

npm ERR! tar.unpack untar error /Users/qufenqi/.npm/react-native-     cli/0.1.4/package.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "react-native-cli"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
 npm ERR! path /usr/local/lib/node_modules/react-native-cli
npm ERR! code EACCES

npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/react-native-cli'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/react-native-      cli']
 npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/react-native-cli',
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/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR!            '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:95:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with a

but when i install node,say " brew install node Warning: node-0.12.7 already installed, it's just not linked"

Upvotes: 2

Views: 9780

Answers (4)

prisar
prisar

Reputation: 3195

without sudo works.

 npm i -g  @react-native-community/cli --force

then check,

npm list @react-native-community/cli

Upvotes: 0

user7219771
user7219771

Reputation:

if the error persists and showing you that the symlink is already exists

npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/react-native-cli/index.js' -> '/usr/local/bin/react-native'
npm ERR! File exists: /usr/local/bin/react-native

add --force

sudo npm install -g react-native-cli --force

Upvotes: 2

Russell Maxfield
Russell Maxfield

Reputation: 968

Run brew doctor

i'll bet that node will show as an "unlinked keg in your cellar"

If thats the case run brew link node

it may fail, but it will give you some options on what you can do such as overwrite or the directory it's trying to write too.

If that doesn't work you may just want to brew uninstall node and reinstall it

Upvotes: 0

You don't have write access to the directory

/usr/local/lib/node_modules/react-native-cli

As you're going to install the library globally, you need admin permissions, so do that as root using sudo command:

sudo npm install -g react-native-cli

Upvotes: 10

Related Questions