npm install 时 No matching version found for react-flow-design@1.1.14
执行 npm install时报错如下:
4017 silly pacote range manifest for react-highcharts@^16.0.2 fetched in 19ms
4018 silly resolveWithNewModule react-highcharts@16.0.2 checking installable status
4019 http fetch GET 304 http://registry.npm.taobao.org/react-flow-design 81ms (from cache)
4020 silly fetchPackageMetaData error for react-flow-design@1.1.14 No matching version found for react-flow-design@1.1.14
4021 http fetch GET 304 http://registry.npm.taobao.org/react-form-design 86ms (from cache)
4022 silly fetchPackageMetaData error for react-form-design@^1.11.5 No matching version found for react-form-design@^1.11.5
4023 http fetch GET 404 http://registry.npm.taobao.org/react-trans-selector 986ms
4024 silly fetchPackageMetaData error for react-trans-selector@1.2.12 404 Not Found: react-trans-selector@1.2.12
4025 timing stage:rollbackFailedOptional Completed in 2ms
4026 timing stage:runTopLevelLifecycles Completed in 27833ms
4027 silly saveTree antd-admin@5.0.8
原因是这个版本的依赖包在私服仓库上找不到,当然我这是没有切换源导致的,这篇尝试在不切换源的前提下正常打包。
1.修改版本号为仓库中存在的版本
以react-flow-design为例,到仓库中(https://npm.taobao.org/package/react-flow-design)查找存在的版本,修改package.json中的版本为可用版本(例如私有源的react-flow-design@1.1.14对应淘宝源的react-flow-design@1.0.4,那么就把版本号由1.1.14改为1.0.4),重新打包,或者单独下载这个依赖。
npm install react-flow-design
2. 删除 package-lock.json 重新打包
部分原因可能是生成的package-lock.json文件有问题,此时需要删除该文件,执行 npm install 再重新生成该文件。