每当我在我的项目基目录中运行npm i时,包锁文件的大小会加倍。这似乎是因为在包锁中有一个"packages“部分,它包含所有项目依赖项,声明为" node_modules /somePackageName",但在所有10,000行之后,有一个”依赖项“部分,它本质上具有所有相同的东西,但没有node_modules前缀部分。每当我的组中的任何人运行npm i时,都没有添加任何新的东西,但是当我使用node_modules/...运行它时,会添加10,000行。都已添加。
我尝试删除node_modules和包锁,然后再次执行npm i,但同样的结果发生了。我理解package-lock的功能,但我不知道为什么它要用不同的路径两次添加所有内容。
这是我的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
}发布于 2021-02-08 16:05:44
对于任何仍然面临这个问题的人,我通过将我的npm版本降低到6.14.5来修复这个问题。(我早些时候在7点)
https://stackoverflow.com/questions/64691364
复制相似问题