React Native创建项目时报错:npm ERR! Windows_NT 10.0.10240 错误

前端之家收集整理的这篇文章主要介绍了React Native创建项目时报错:npm ERR! Windows_NT 10.0.10240 错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.问题描述


React Native创建项目时报一堆的错:


spawn-sync@1.0.15 postinstall D:\RN_Android\app_projects\fendo\node_modules\react-native\node_modules\yeoman-generator\node_modules\cross-spawn\node_modules\spawn-sync
> node postinstall


npm WARN peerDependencies The peer dependency react@~15.3.1 included from react-native will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain,use it instead!
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\sowafort\\nodejs\\node.exe" "C:\\sowafort\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "react-native"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! path C:\Users\fendo\AppData\Roaming\npm-cache\babel-traverse\6.16.0\package.tgz.1360063874
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename


npm ERR! Error: EPERM: operation not permitted,rename 'C:\Users\fendo\AppData\Roaming\npm-cache\babel-traverse\6.16.0\package.tgz.1360063874' -> 'C:\Users\fendo\AppData\Roaming\npm-cache\babel-traverse\6.16.0\package.tgz'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted,rename 'C:\Users\fendo\AppData\Roaming\npm-cache\babel-traverse\6.16.0\package.tgz.1360063874' -> 'C:\Users\fendo\AppData\Roaming\npm-cache\babel-traverse\6.16.0\package.tgz']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\fendo\\AppData\\Roaming\\npm-cache\\babel-traverse\\6.16.0\\package.tgz.1360063874',
npm ERR! dest: 'C:\\Users\\fendo\\AppData\\Roaming\\npm-cache\\babel-traverse\\6.16.0\\package.tgz',
npm ERR! parent: 'babel-plugin-transform-es2015-classes' }
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! D:\RN_Android\app_projects\fendo\npm-debug.log



`npm install --save --save-exact react-native` Failed


2.解决方法


由于我是win10的系统,并没有用管理员运行Dos所以他才会报错,win+x然后以管理员运行Dos就行了。

猜你在找的React相关文章