[英]Heroku: Update Node to latest version
I would like to update my node version to latest version possible on my local machine. 我想在本地计算机上将节点版本更新为最新版本。 I am using Ubuntu 16.04.
我正在使用Ubuntu 16.04。 I am currently finding trouble to update with methods available to my best of knowledge .
我目前很难用我最了解的方法更新。 Please note that
heroku-cli
is up to date(as of yet). 请注意,
heroku-cli
是最新的(截至目前)。
$ check-node-version
node: 8.3.0
npm: 5.4.2
yarn: 1.2.1
Here are other important commands which may help 以下是其他可能有用的重要命令
harman@manchanda: 04:14 pm ~ $ node -v
v8.3.0
harman@manchanda: 04:14 pm ~ $ which node
/usr/local/heroku/bin/node
harman@manchanda: 04:15 pm ~ $ nodejs -v
v8.7.0
harman@manchanda: 04:15 pm ~ $ which nodejs
/usr/bin/nodejs
harman@manchanda: 04:15 pm ~ $ heroku -v
heroku-cli/6.14.34-1fcf80e (linux-x64) node-v8.6.0
harman@manchanda: 04:15 pm ~ $ n
node/6.2.2
node/6.7.0
node/7.0.0
node/7.8.0
node/7.9.0
node/8.4.0
node/8.7.0
Let me know if any other information is needed for same? 如果需要任何其他信息,请告诉我?
Assuming you have installed n
package on your local machine, you can run 假设您已在本地计算机上安装了
n
软件包,则可以运行
sudo n latest
to update Node to the latest version available (8.7.0 at the moment of writing this answer) 将Node更新到可用的最新版本(写下此答案时的8.7.0)
Or, if you want to use the latest Node in your heroku dyno: 或者,如果您想在heroku dyno中使用最新的节点:
package.json
package.json
Add "engines": { "node": "8.7.0" },
like that: 添加
"engines": { "node": "8.7.0" },
如下所示:
{ "name": "node-example", "version": "1.0.0", "description": "This example is so cool.", "main": "web.js", "scripts": { "test": "echo \\"Error: no test specified\\" && exit 1" }, "keywords": [ "example", "heroku" ], "author": "jane-doe", "license": "MIT", "engines": { "node": "8.7.0" }, }
git add package.json && git commit -m "Specified node version"
git push heroku master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.