简体   繁体   English

更新NPM包

[英]Update NPM Packages

I seem to understand how to clone a repository, but I'm not sure I'm fully grasping how to keep that repository current with what's on Github. 我似乎理解如何克隆存储库,但我不确定我是否完全掌握如何使该存储库与Github上的内容保持同步。 I'm using Basscss for example, and I believe my local project is slightly out of date with what's on Github. 我正在使用Basscss ,我相信我的本地项目与Github上的内容略有过时。

I'm trying to update Basscss to the latest version using npm update but even after running that command my package.json file remains the same with the version stuck at "4.2.1". 我正在尝试使用npm update将Basscss更新到最新版本,但即使在运行该命令后,我的package.json文件仍与“4.2.1”中的版本保持一致。

"name": "basscss",
"version": "4.2.1",
...

Am I doing something wrong here? 我在这里做错了吗? Any help with this is appreciated. 对此有任何帮助表示赞赏。 Thanks in advance! 提前致谢!

npm update will update the module's files listed in your project. npm update将更新项目中列出的模块文件。 if you want to update your package.json file with the newer version. 如果你想用更新的版本更新你的package.json文件。 use the save option. 使用保存选项。

npm update --save


edit 编辑

npm install basscss@latest --save

I would try to re-install latest and save to package file. 我会尝试重新安装最新的并保存到包文件。 BTW, your package.json should reference the dep's like this: 顺便说一句,你的package.json应该像这样引用dep:

"name" : "YOUR_PROJECT",
"version" : "0.0.1",
"dependencies": {
  "basscss": "^4.2.4",
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM