gpt4 book ai didi

node.js - 关于管理 React node_modules 的建议

转载 作者:太空宇宙 更新时间:2023-11-04 03:03:27 25 4
gpt4 key购买 nike

你好。我已经为一个新的大型应用程序工作了大约一年。在工作过程中,我一直使用两台相同的机器,一台在工作,一台在办公室。通过 github 共享源。家里的机器与 git 同步,工作的机器则完成很多繁重的工作。由于错误和 Google 上的搜索,我得到的建议(似乎是合理的)重新安装 React 的供应商开发端,由

rm -rf node_modules
npm install

应用程序陷入了尖叫堆,我认为它没有机会运行!文件 package.json 在一台机器上与另一台机器上相同,但是,仅在一台机器上运行 npm install 后,node_modules 中有 4435 个文件不同!

这对于版本控制和软件安全来说是一场噩梦。我没有手动构建包文件,npm 在“啊,我需要那个”的过程中完成了

npm install redux-form --save

包文件。

{
"name": "asset_intel",
"version": "1.0.0",
"description": "Application re-write for Asset-IQ Dealer network",
"main": "index.js",
"repository": "",
"scripts": {
"start": "webpack-dev-server",
"build": "webpack --config webpack.config.js"
},
"author": "Mark Addinall",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"chai": "^3.5.0",
"chai-jquery": "^2.0.0",
"jquery": "^2.2.1",
"jsdom": "^8.1.0",
"mocha": "^2.4.5",
"react-addons-test-utils": "^0.14.7",
"webpack": "^3.1.0",
"webpack-dev-server": "^2.5.0"
},
"dependencies": {
"axios": "^0.15.3",
"babel-polyfill": "^6.23.0",
"babel-preset-stage-1": "^6.1.18",
"css-loader": "^0.28.4",
"file-loader": "^0.11.2",
"lodash": "^3.10.1",
"prop-types": "^15.5.10",
"react": "^0.14.9",
"react-addons-update": "^15.5.2",
"react-autosuggest": "^9.0.1",
"react-bootstrap": "^0.31.0",
"react-bootstrap-autosuggest": "^0.5.0",
"react-dnd": "^2.4.0",
"react-dnd-html5-backend": "^2.4.1",
"react-dom": "^0.14.9",
"react-dropzone": "^3.13.2",
"react-hot-loader": "^1.3.1",
"react-images-uploader": "^1.0.1",
"react-redux": "^4.0.0",
"react-redux-modal": "^0.5.2",
"react-router": "^2.8.1",
"react-sparklines": "^1.6.0",
"react-widgets": "^3.4.8",
"redux": "^3.0.4",
"redux-accordion": "^1.0.721",
"redux-ajax": "^1.0.5",
"redux-form": "^6.5.0",
"redux-promise": "^0.5.3",
"redux-tooltip": "^0.7.2",
"style-loader": "^0.16.1",
"youtube-api-search": "0.0.5"
}
}

不是很复杂。我决定将工作的 node_modules 粘贴到 git 中,并且我想我会将版本粘贴到 package.json 中。

其他人如何在复杂的应用程序中管理此控件?

干杯,马克。

最佳答案

我认为,你应该阅读有关包锁的文章:https://docs.npmjs.com/files/package-locks并使用它,因为在您的情况下您已经立即更新了很多库。当您拥有锁定文件时,实际上您的 git 存储库中不需要 node_modules

关于node.js - 关于管理 React node_modules 的建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47745561/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com