npm start 时报 node_modules/nan 错误


> node devServer.js

Listening at http://localhost:3001
node_modules/nan
resolve failed for "caniuse-db": Error: Cannot find module 'caniuse-db'
resolve failed for "babel-runtime": Error: Cannot find module 'babel-runtime'
resolve failed for "webpack-core": Error: Cannot find module 'webpack-core'
/Users/elvinlong/m.zentrust.cn/node_modules/webpack-core/lib/NormalModuleMixin.js:151
				throw e;
				^

TypeError: Cannot read property 'displayName' of undefined


解决方法
修改.babelrc文件

{
  "presets": [
    "es2015-loose", // 改为 ["es2015", { "loose":true }],
    "stage-0",
    "react"
  ],
  "plugins": [
    "transform-decorators-legacy",
    "transform-class-properties"
  ],
  "env": {
    "development": {
      "plugins": [
        "react-hot-loader/babel"
      ]
    },
    "production": {
    }
  }
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM