2

我正在使用的图表库有一个错误,要解决这个问题,我应该运行这个脚本:https ://github.com/plouc/nivo/blob/master/scripts/patch-react-spring.js 。在构建之前。我曾想过添加“prebuild”:“npm run patch-react-spring.js”并在package.json下的根目录中添加patch-react-spring.js文件。但是,当我执行 npm run patch-react-app 或 npm run prebuild 时,我得到错误:npm ERR!缺少脚本:patch-react-spring.js

这是该项目的 GitHub 存储库:https ://github.com/JonasHendel/SunPosition

4

1 回答 1

3

您可以尝试使用此库

https://www.npmjs.com/package/patch-package


    # fix a bug in one of your dependencies
    vim node_modules/some-package/brokenFile.js
    
    # run patch-package to create a .patch file
    npx patch-package some-package
    
    # commit the patch file to share the fix with your team
    git add patches/some-package+3.14.15.patch
    git commit -m "fix brokenFile.js in some-package"

在 package.json

 "scripts": {
"postinstall": "patch-package"
 }
于 2021-03-19T16:36:24.780 回答