zoukankan      html  css  js  c++  java
  • react 打包报 createRequire is not a function Referenced from: BaseConfig

    项目更新,提交后Jenkins部署报以下错误:

    Creating an optimized production build...
    Failed to compile.
    
    createRequire is not a function
    Referenced from: BaseConfig
    
    
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! lcloud_webview@0.1.0 build: `react-scripts build`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the lcloud_webview@0.1.0 build script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    删除node_modules和整个工作区间都试了一次,还是报错。在本地一切正常。

    搜索后发现:BaseConfig is a variable of the create-react-app react-scripts module in node_modules/react-scripts/config/webpack.config.js

    之前因为其它原因升级过react-scripts和react包,而react-scripts 4.x需要更高点的node版本支持,

    我在Jenkins上试着升级node和npm提示没有权限,没办法只能把react-scripts降到3.x,react降到16.x,最后得以解决问题。

  • 相关阅读:
    pip安装
    nfs
    源码方式安装软件
    自启动
    multipath
    linux永久添加和删除路由
    iscsi
    linux识别workstation磁盘的uuid
    centos镜像各种cd,dvd版本区别
    转:C# 中 MSCHART 饼状图显示百分比
  • 原文地址:https://www.cnblogs.com/gxp69/p/14557018.html
Copyright © 2011-2022 走看看