node.js - 反应本机 package-lock.json 重复依赖项/包
问题描述
每当我在我的项目基目录中运行 npm i 时,包锁定文件的大小都会增加一倍。这似乎正在发生,因为包锁中有一个“包”部分,其中包含所有项目依赖项,称为“node_modules/somePackageName”,但在所有这些行中的 10,000 行之后,有一个“依赖项”部分基本上包含所有相同的东西,但没有 node_modules 前缀部分。每当我组中的任何人运行 npm i 时,都不会添加任何新内容,但是当我运行它时,会添加带有 node_modules/... 的 10,000 行。
我尝试删除 node_modules 以及包锁,然后再次执行 npm i ,但结果相同。我了解包锁的功能,但我不知道为什么它会使用不同的路径两次添加所有内容。
这是我的 package.json:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios --simulator=\"iPhone 11 Pro Max\"",
"web": "expo start --web",
"eject": "expo eject",
"lint": "eslint --ext .js,.jsx ./components --quiet",
"lint-autofix": "eslint --ext .js,.jsx ./components --quiet --fix"
},
"dependencies": {
"@expo-google-fonts/montserrat": "^0.1.0",
"@expo/vector-icons": "^10.2.1",
"@react-navigation/bottom-tabs": "^5.9.2",
"@react-navigation/native": "^5.7.6",
"expo": "^39.0.3",
"expo-font": "~8.3.0",
"expo-status-bar": "~1.0.2",
"firebase": "7.9.0",
"prop-types": "^15.7.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
"react-native-gesture-handler": "~1.7.0",
"react-native-paper": "^4.2.0",
"react-native-reanimated": "^1.13.1",
"react-native-screens": "~2.10.1",
"react-native-vector-icons": "^7.1.0",
"react-native-web": "~0.13.12",
"react-navigation-stack": "^2.10.1",
"styled-components": "^5.2.0"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"eslint": "^7.11.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react-hooks": "^4.1.2"
},
"private": true
}
解决方案
对于仍然面临这个问题的任何人,我通过将我的 npm 版本降级到 6.14.5 来解决这个问题。(我早7点)
推荐阅读
- python - 在python中乘以字符串向量
- android - 在 Android 应用中将 Truecaller SDK 与 OTP 集成
- android - 我在改造 android 中使用 Login Api 时遇到问题
- linux - 在没有 Nvidia 的系统上运行应用程序
- azure - Allow/Deny users using web.config in Azure app service
- database - 无法让@Typeconverters 在地板颤动中工作
- python - 在 Heroku 上部署 Nodejs App + Python 时遇到问题
- ios - LazyVStack 和 SwiftUI 的性能不佳问题
- apache-zookeeper - 如何一次创建多个znode?
- android - 通过 JDBC 使用 Compute Engine 连接到 Cloud SQL