我刚刚安装Node.js和npm(用于其他模块).
如何将Node.js和我正在使用的模块更新到最新版本?
可以npm这样做,还是我必须删除并重新安装Node.js和npm才能获得下一个版本?
我按照本npm节中的步骤操作.
例如,为什么Grunt插件将其对grunt的依赖定义为" 对等依赖 "?
为什么插件不能将Grunt作为grunt-plug/node_modules中的依赖?
此处描述了对等依赖关系:https://nodejs.org/en/blog/npm/peer-dependencies/
但我真的不明白.
例
我正在使用AppGyver Steroids,它使用Grunt任务将我的源文件构建到/ dist /文件夹中,以便在本地设备上提供.我在npm和grunt都很新,所以我想完全理解发生了什么.
到目前为止我得到了这个:
[rootfolder] /package.json告诉npm它取决于grunt-steroids用于开发的npm包:
"devDependencies": {
"grunt-steroids": "0.x"
},
Run Code Online (Sandbox Code Playgroud)
好的.在[rootfolder]中运行npm install 会检测依赖项并在[rootfolder]/node_modules/grunt-steroids中安装grunt-steroids.
Npm然后读取[rootfolder] /node_modules/grunt-steroids/package.json,以便它可以安装grunt-steroids自己的依赖项:
"devDependencies": {
"grunt-contrib-nodeunit": "0.3.0",
"grunt": "0.4.4"
},
"dependencies": {
"wrench": "1.5.4",
"chalk": "0.3.0",
"xml2js": "0.4.1",
"lodash": "2.4.1"
},
"peerDependencies": {
"grunt": "0.4.4",
"grunt-contrib-copy": "0.5.0",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-concat": "0.4.0",
"grunt-contrib-coffee": "0.10.1",
"grunt-contrib-sass": "0.7.3",
"grunt-extend-config": "0.9.2"
},
Run Code Online (Sandbox Code Playgroud)
" dependencies "包安装在 …