美文网首页
常见错误解决

常见错误解决

作者: 兔子不打地鼠打代码 | 来源:发表于2018-03-08 19:19 被阅读179次

    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
    }
    

    相关文章

      网友评论

          本文标题:常见错误解决

          本文链接:https://www.haomeiwen.com/subject/wfssfftx.html