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,最后得以解决问题。

  • 相关阅读:
    xgboost中XGBClassifier()参数详解
    xgboost使用经验总结
    特征选择之Chi卡方检验
    ldd 查看程序依赖库
    paddle——docker实践
    paddle实践
    java常用设计模式
    Java内存模型
    什么是线程?
    MySQL数据库提供了那些函数?
  • 原文地址:https://www.cnblogs.com/gxp69/p/14557018.html
Copyright © 2011-2022 走看看