zoukankan      html  css  js  c++  java
  • 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": {
        }
      }
    }
    
    
  • 相关阅读:
    关于产品
    Windows服务 + Quartz.NET
    C#
    C#
    URL
    前端生态系统总结
    字符串相似度
    Process Explore & Windbg
    webpack
    JS
  • 原文地址:https://www.cnblogs.com/ElvinLong/p/6400431.html
Copyright © 2011-2022 走看看