简体   繁体   English

Heroku:将节点更新到最新版本

[英]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中使用最新的节点:

  1. Open your local project's root 打开本地项目的根目录
  2. Open package.json 打开package.json
  3. 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" }, }

  4. git add package.json && git commit -m "Specified node version"

  5. git push heroku master

Reference 参考

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

相关问题 如何将lodash更新到最新版本 - How to update lodash to the latest version 节点:以编程方式检查软件包的最新版本 - Node: check latest version of package programmatically 如何卸载最新节点并降级到旧版本 - How to uninstall latest node & downgrade to old version 如果浏览器不是最新版本,则强制浏览器更新 - Force browser update if browser not latest version 从 Heroku 应用程序上抓取的网站更新和获取最新数据 - Update and fetch the latest data from scraped website on Heroku app 'npm 是否安装'l<package_name> 安装一个package的最新版本还是安装最新版本的node兼容?</package_name> - Does 'npm instal'l <package_name> install the latest version of a package or the latest compatible with the version of node installed? 在squeeze上安装Node-js最新版本的问题 - Issues in installing node-js latest version on squeeze React npm 启动问题 - node.js 最新版本 - React npm start issue - node.js latest version 如何更新此jQuery脚本以使其与最新的jQuery版本3.3.1一起使用? - How to update this jQuery script to work with latest jQuery version 3.3.1? 确保用户在更新后获得网站最新版本的正确方法 - Correct method for ensuring users get the latest version of a website after an update
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM