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": {
    }
  }
}

posted @ 2017-02-15 10:44  ElvinLong  阅读(1735)  评论(1编辑  收藏  举报