无法解析模块“反应”
Unable to resolve module `react`
我克隆了https://github.com/oblador/react-native-progress
在示例文件夹中:
npm i
react-native run-ios
但是我得到一个错误,这是错误截图link: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
模块可以?
示例在 package.json
文件
中构建节点依赖项时出错
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.47.2",
"react-native-progress": "file:../" // error
},
修复
- 在示例文件夹中 运行
npm uninstall react-native-progress
- 卸载后运行
npm install react-native-progress --save
然后 运行 您的示例应用正常
我克隆了https://github.com/oblador/react-native-progress
在示例文件夹中:
npm i
react-native run-ios
但是我得到一个错误,这是错误截图link: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
模块可以?
示例在 package.json
文件
"dependencies": {
"react": "16.0.0-alpha.12",
"react-native": "0.47.2",
"react-native-progress": "file:../" // error
},
修复
- 在示例文件夹中 运行
npm uninstall react-native-progress
- 卸载后运行
npm install react-native-progress --save
然后 运行 您的示例应用正常