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

  • 相关阅读:
    14个你可能不知道的JavaScript调试技巧
    数据库设计四步骤
    mac 卸载 jdk
    node版本管理
    mysql order by limit 问题
    计算机一些基本概念的认识
    SQL设置主外键关联时报错
    阻止表单autocomplete
    常见字符编码
    编程语言分类
  • 原文地址:https://www.cnblogs.com/gxp69/p/14557018.html
Copyright © 2011-2022 走看看