1編譯安裝
Linux環境下:
確保系統下g++版本在4.6以上,python版本在2.6以上。
從nodejs.org下載tar.gz後綴的NodeJS最新版源代碼包並解壓到某個位置。
進入解壓到的目錄,使用以下命令編譯和安裝。
./configure
make
sudo make install
終端輸入
//進入node交互模式
node
console.lo(1)
// 1
// undefined
運行js文件
//test.js
const hello = () => {
console.log('hello word')
}
hello()
//終端輸入
node test.js
權限問題
在root用戶下操作
或者
chmod -R 777 path
Windows環境下:
百度下載node.exe即可使用