我在安装React-native时遇到错误,我试图搜索答案,但我找不到答案。
当运行“react-native init meet”时,我收到此错误:
This will walk you through creating a new React Native project in /Users/alfred/React/meet
Installing react-native package from npm...
Setting up new React Native app in /Users/alfred/React/meet
module.js:338
throw err;
^
Error: Cannot find module './src/init'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/alfred/React/meet/node_modules/react-native/node_modules/yeoman-generator/node_modules/download/node_modules/vinyl-fs/node_modules/gulp-sourcemaps/index.js:4:9)
at Module._compile (module.js:434:26)
at Module._extensions..js (module.js:452:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/alfred/React/meet/node_modules/react-native/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
我真的没有弄错...
答案 0 :(得分:31)
这与gulp-sourcemaps最近部署https://github.com/floridoo/gulp-sourcemaps/issues/238
的问题有关一个项目维护者在线程结束时说他今天会接到它并且
暂时将您的版本锁定到2.0.x或1.7.x
要解决此问题,请在package.json
中添加特定版本,直到问题得到解决:
{
"devDependencies": {
"gulp-sourcemaps": "1.7.x"
}
}
使用npm shrinkwrap来防止将来出现类似问题。
答案 1 :(得分:4)
这是由gulp-sourcemaps
的最近更改引起的。请参阅此处的错误:https://github.com/floridoo/gulp-sourcemaps/issues/238
答案 2 :(得分:1)
现在已修复。运行npm install https://github.com/floridoo/gulp-sourcemaps/issues/238