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

  • 相关阅读:
    唐伯虎
    朱元璋
    [再寄小读者之数学篇](2014-06-28 证明级数几乎处处收敛)
    [家里蹲大学数学杂志]第053期Legendre变换
    About the Importance of Aim in Life
    An Apple a day keeps the doctor away
    Love Me,Love My Dog
    关于工作
    关于失败
    Erdos
  • 原文地址:https://www.cnblogs.com/gxp69/p/14557018.html
Copyright © 2011-2022 走看看