简体   繁体   English

如何使用我的新 NPM 版本更新我的项目?

[英]How to update my Project with my new NPM version?

How are you all?你们好吗?

I'm really new at this.我真的很陌生。 I'm having trouble deploying my react project.我在部署我的反应项目时遇到问题。 When I do it, the entire website is blank.当我这样做时,整个网站都是空白的。 Someone said to me that I should update my Node and my NPM.有人对我说,我应该更新我的 Node 和我的 NPM。 That leads me to the first question: "When I update the NPM, I'm updating Node at the same time, right?"这让我想到了第一个问题:“当我更新 NPM 时,我也在同时更新 Node,对吧?”

So I researched and found this command:所以我研究并发现了这个命令:

npm cache clean -f
sudo npm install -g n stable

And I think that updated my NPM.而且我认为更新了我的 NPM。 Done that, I ran the GIT STATUS to see if something were modified in my project.完成后,我运行了 GIT STATUS 以查看我的项目中是否有某些内容被修改。 Nothing.没有什么。 But that leads me to my second question: "Cool... but now I have to update my project with my new NPM version, right?"但这引出了我的第二个问题:“酷……但现在我必须用我的新 NPM 版本更新我的项目,对吧?”

I tried:我试过了:

NPM UPDATE

But then i checked my git status again and nothing was modified.但后来我再次检查了我的 git 状态,没有任何修改。 How can I update it?我该如何更新它?

Thanks guys.多谢你们。 I really hope I did this right.我真的希望我做对了。

First of all, you have to understand npm & node is the environment to run the projects on your computer (local).首先,您必须了解 npm & node 是在您的计算机(本地)上运行项目的环境。 It's global and not belong to any project.它是全球性的,不属于任何项目。 So if you install or update global, it won't affect your project (specific on your working copy git) because it's the global, and only is the environment to run, you can check dependencies on your package.json file.因此,如果您安装或更新全局,它不会影响您的项目(特定于您的工作副本 git),因为它是全局的,并且只是要运行的环境,您可以检查 package.json 文件的依赖关系。 If you wanna update node to latest: sudo npm cache clean -f sudo npm install -gn sudo n stable update npm to latest version: npm install npm@latest -g If you wanna update node to latest: sudo npm cache clean -f sudo npm install -gn sudo n stable update npm to latest version: npm install npm@latest -g

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

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