22

安装 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)

我真的不明白有什么问题...

4

3 回答 3

32

它与 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以防止将来出现类似问题。

于 2016-10-13T21:21:58.110 回答
4

这是由最近的变化引起的gulp-sourcemaps。在此处查看错误:https ://github.com/floridoo/gulp-sourcemaps/issues/238

于 2016-10-13T21:21:54.203 回答
1

现在已修复。运行 npm install https://github.com/floridoo/gulp-sourcemaps/issues/238

于 2016-10-14T13:36:15.157 回答