常见错误解决

1、Cannot resolve module 'babel-loader'

在控制台中运行命令“webpack”,出现错误:“ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in.........”

解决方法是在控制台输入命令“npm install babel-loader --save"。

2、 TypeError: fileSystem.statSync is not a function

npm install webpack@3.0.0 --save-dev

3、报错如图

 Warning: Accessing PropTypes via the main React package is deprecated, and will be removed in  React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs
 Warning: Accessing createClass via the main React package is deprecated, and will be removed in React v16.0. Use a plain JavaScript class instead. If you're not yet ready to migrate, create-react-class v15.* is available on npm as a temporary, drop-in replacement. For more info see https://fb.me/react-create-class

解决办法:
1.安装PropTypes
npm install -S prop-types
2.像这样导入PropTypes
import PropTypes from 'prop-types';
而不是这样做:
import { PropTypes } from 'react';
3.请确保不要使用React.PropTypes,示例:

MyComponent.propTypes = {
    MyString: PropTypes.string.isRequired
}
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容