Reputation: 10470
I am trying to follow the instructions for "Getting started with react-native".
I know that using windows for my development platform is experimental but this is what I am doing. I start a "Node.js command prompt" then do ...
> npm install -g react-native-cli
> react-native init AwesomeProject
... but I get this error ...
C:\Users\plankton>react-native init AwesomeProject
This will walk you through creating a new React Native project in C:\Users\plankton\AwesomeProject
Installing react-native package from npm...
> [email protected] install C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild
C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
bufferutil.cc
win_delay_load_hook.c
Creating library C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\bufferutil\build\Release\bufferutil.lib and object C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\bufferutil\build\Release\bufferutil.exp
Generating code
Finished generating code
bufferutil.vcxproj -> C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\bufferutil\build\Release\\bufferutil.node
> [email protected] install C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild
C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
validation.cc
win_delay_load_hook.c
Creating library C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.lib and object C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.exp
Generating code
Finished generating code
validation.vcxproj -> C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\ws\node_modules\utf-8-validate\build\Release\\validation.node
> [email protected] postinstall C:\Users\plankton\AwesomeProject\node_modules\react-native\node_modules\yeoman-generator\node_modules\cross-spawn\node_modules\spawn-sync
> node postinstall
npm WARN optional dep failed, continuing [email protected]
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-native"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! path C:\Users\plankton\AppData\Roaming\npm-cache\brace-expansion\1.1.2\package\package.json.9d769f6c66df6b0ff357401140ec21e2
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\plankton\AppData\Roaming\npm-cache\brace-expansion\1.1.2\package\package.json.9d769f6c66df6b0ff357401140ec21e2' -> 'C:\Users\plankton\AppData\Roaming\npm-cache\brace-expansion\1.1.2\package\package.json'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename 'C:\Users\plankton\AppData\Roaming\npm-cache\brace-expansion\1.1.2\package\package.json.9d769f6c66df6b0ff357401140ec21e2' -> 'C:\Users\plankton\AppData\Roaming\npm-cache\brace-expansion\1.1.2\package\package.json']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\plankton\\AppData\\Roaming\\npm-cache\\brace-expansion\\1.1.2\\package\\package.json.9d769f6c66df6b0ff357401140ec21e2',
npm ERR! dest: 'C:\\Users\\plankton\\AppData\\Roaming\\npm-cache\\brace-expansion\\1.1.2\\package\\package.json',
npm ERR! parent: 'minimatch' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\plankton\AwesomeProject\npm-debug.log
`npm install --save react-native` failed
The error output suggest: Please try running this command again as root/Administrator.
, but how do I do that on a Windows 10 system?
UPDATE: Thank Louy your answer works. Here's a screen shot of what I ended up doing ...
Right click the Node.js command promtpt
and select Run as Administrator
.
UPDATE II: On subsequent iterations I got the same error. I what I had to do then was what Louy said to do in the comment:
delete the folder "C:\\Users\\plankton\\AppData\\Roaming\\npm-cache
UPDATE III:
I had run my Node.js command prompt as Administrator and I had deleted the folder "C:\\Users\\plankton\\AppData\\Roaming\\npm-cache
and yet I still got the running this command again as root/Administrator
error. I had to use Windows Explorer to unset the Read only
and hidden
properties off the "C:\Users\plankton\AppData` folder.
Upvotes: 0
Views: 1174
Reputation: 7408
You need to start up your command line interpreter as an administrator.
Then do the same as you did earlier.
Upvotes: 2