无法解决模块`react`

时间:2017-09-23 17:24:59

标签: node.js reactjs react-native node-modules

我克隆了https://github.com/oblador/react-native-progress

在示例文件夹中:

npm i

react-native run-ios

但是我收到了错误,这是错误的屏幕截图链接:Unable to resolve module react

这是代码:

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
  Animated,
  Easing,
  View,
  ViewPropTypes,
} from 'react-native';

为什么我的react模块无法解析但react native模块无法解决?

1 个答案:

答案 0 :(得分:1)

示例在package.json文件

中构建节点依赖项时出错
 "dependencies": {
    "react": "16.0.0-alpha.12",
    "react-native": "0.47.2",
    "react-native-progress": "file:../" // error
  },

修复

  1. 在示例文件夹中运行npm uninstall react-native-progress
  2. 卸载后运行npm install react-native-progress --save
  3. 然后正常运行您的示例应用

相关问题