node 安裝與更新

2021-10-04 09:35:12 字數 986 閱讀 7411

參考 

1. 使用 brew 或者 n 管理 node.js

on mac

$ brew install n
on linux, n-install allows installation directly from github; for instance: (參考

$ curl -l  | bash

=== n successfully installed.

the active node.js version is: v12.16.1

run `n -h` for help.

to update n later, run `n-update`.

to uninstall, run `n-uninstall`.

important: open a new terminal tab/window or run `. ~/.bashrc`

before using n and node.js.

===$ . ~/.bashrc

$ n

2. 安裝或更新node.js過程中可能遇到網路、依賴等問題,以下可以解決問題

brew uninstall --ignore-dependencies --force node

brew uninstall --ignore-dependencies --force icu4c

brew install icu4c

brew unlink icu4c && brew link icu4c --force

brew install node

如果安裝完成後沒有鏈結到 /usr/local/bin/node ,可以手動鏈結

ln -s /usr/local/cellar/node/13.11.0/bin/node /usr/local/bin/node

node 更新公升級

npminstall g n n stable n v7.6.0 npm v 顯示版本,檢查npm 是否正確安裝。npm install express 安裝express模組 npm install g express 全域性安裝express模組 npm list 列出已安裝模組 npm sho...

node的安裝與hello world

一 mac安裝node 1.使用homebrew安裝即可 brew install node 2.安裝成功後,可以使用以下命令檢視node的版本 node v 二 建立hello world的web程式 1.建立乙個hello.js檔案,寫入 console.log httpd start 8000...

mac更新node版本

1,清除node.js的cache sudo npm cache clean f 2,安裝 n 工具,這個工具是專門用來管理node.js版本的,別懷疑這個工具的名字,是他是他就是他,他的名字就是 n sudo npm install g n 3,安裝最新版本的node.js sudo n stab...