简体   繁体   English

更新Google Compute Engine上的Node / NPM?

[英]Update Node/NPM on Google Compute Engine?

I am running a fresh image of a Google Compute Engine VM with Node.js v6.16 . 我正在使用Node.js v6.16运行Google Compute Engine VM新映像

How do I update this to latest? 如何将其更新为最新? v6 doesn't even support async functions. v6甚至不支持异步功能。

In order to update Node.js, first SSH into the instance, you can do it from the Deployment Manager Console view, clicking the "SSH" button. 为了更新Node.js,首先要SSH进入实例,您可以从Deployment Manager控制台视图中单击“ SSH”按钮来进行操作。

Then, in the instance, you can check the version of Node.js with this command: 然后,在实例中,您可以使用以下命令检查Node.js的版本:

node -v

To update Node.js enter the next commands, (check codeforgeek.com ): 要更新Node.js,请输入以下命令(请检查codeforgeek.com ):

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

Then exit the session and log in again, or reboot the VM, and if you check the version it will be the updated one. 然后退出会话并再次登录,或重新启动VM,如果您检查版本,它将是更新的版本。

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

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