我正在嘗試按照"Getting started with react-native"的說明進行操作。react-native init Awesomeproject「npm ERR!請嘗試以root/Administrator身份再次運行此命令。」 windows 10
我知道使用Windows對我的開發平臺是實驗性的,但是這是我在做什麼。我開始 「的Node.js命令提示符」,然後做...
> npm install -g react-native-cli
> react-native init AwesomeProject
...但我得到這個錯誤...
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
錯誤輸出提示:Please try running this command again as root/Administrator.
,但怎麼辦我在Windows 10系統上這樣做?
UPDATE:謝謝盧伊你的答案的作品。下面是我最後做了截屏...
右鍵單擊Node.js command promtpt
並選擇Run as Administrator
。
UPDATE II:在隨後的迭代中,我得到了同樣的錯誤。我我該怎麼做,然後是什麼盧伊說在註釋中要做到:
刪除該文件夾"C:\\Users\\plankton\\AppData\\Roaming\\npm-cache
UPDATE III:
我跑我的Node.js的命令提示符管理員,我有刪除文件夾"C:\\Users\\plankton\\AppData\\Roaming\\npm-cache
,但我仍然得到了running this command again as root/Administrator
錯誤。我不得不使用Windows資源管理器來取消該Read only
和hidden
性能掉了「C:\用戶\浮游生物\ AppData`文件夾
它可以是你已經安裝了以前的東西作爲管理員。您是否嘗試刪除文件夾「C:\\ Users \\ plankton \\ AppData \\ Roaming \\ npm-cache」? – Louy