node在Fedora 22系統下開發環境搭建

來源:互聯網
上載者:User

標籤:node在fedora 22系統下開發環

     其實,環境搭建在linux系統還是比較簡單的,下載已經編譯好的包,配置一下環境變數。或者下載源碼,自己編譯。

   這裡記錄一下,主要是node版本變化節奏非常塊的情況下,如何配置一次環境變數就不要再配置了。

   下載並解壓node-v0.12.7-linux-x64二進位檔案,

目錄:

[[email protected] node-v0.12.7-linux-x64]$ pwd
/home/doctor/opt/node-v0.12.7-linux-x64


設定檔:

[[email protected] ~]$ l.
.                .bashrc      .gtkrc-2.0-kde4  .pgadmin_histoqueries
..               .cache       .IntelliJIdea14  .pgpass
.adobe           .config      .java            .pki
.aliedit         .directory   .kde             .rediscli_history
.android         .eclipse     .local           .Spring Tool Suite
.attach_pid2075  .esd_auth    .m2              .thumbnails
.attach_pid2282  .fonts.conf  .macromedia      .viminfo
.bash_history    .gitconfig   .mozilla         .WebStorm10
.bash_logout     .gnome       .npm             .Xauthority
.bash_profile    .gnupg       .pgadmin3        .xsession-errors
[[email protected] ~]$

在.bashrc 檔案中,加入 node環境配置:

export NODE_HOME=/home/doctor/opt/node
export PATH=$NODE_HOME/bin:$PATH


(上面的home目錄也可以用${HOME}代替)
注意:這裡配置的是node,而不是具體版本.

在opt目錄中,我們用軟串連關聯環境檔案中的node目錄與具體node版本目錄:

[[email protected] ~]$ ln -s node-v0.12.7-linux-x64 node




[[email protected] opt]$ ll node
lrwxrwxrwx. 1 doctor doctor 22 7月  11 10:13 node -> node-v0.12.7-linux-x64
[[email protected] opt]$

軟串連已建立。


執行:[[email protected] opt]$ source /home/doctor/.bashrc  使得配置生效。


驗證一下:

[[email protected] opt]$ node -v
v0.12.7
[[email protected] opt]$ node
> console.log(‘hello doctor‘);
hello doctor
undefined
>



以後我們再使用新版本的時候,我們只需變更軟串連,unlink node 取消,再重新ln -s node-xxxx-linux-x64 node

即可。

(當然,你為了省事情,也可以只建立node目錄,把新版本的內容copy過去。)

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

node在Fedora 22系統下開發環境搭建

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.