【Fis】mac安裝fis以及使用 step1:安裝nvm

step1:安裝nvm

先裝nvm,這是node的一個管理器,官網說明:https://github.com/nvm-sh/nvm/blob/master/README.md#installing-and-updating

方法一:

直接用curl安裝:curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh|bas

也可以使用wget安裝:wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh|bash

執行完命令之後如下圖所示:

exportNVM_DIR="$HOME/.nvm"[-s"$NVM_DIR/nvm.sh"]&&\."$NVM_DIR/nvm.sh"#This loads nvm 寫入~/.bash_profile 或者 ~/.zshrc 或者 ~/.profile 或者 ~/.bashrc文件中。一般第一步之後,會自動寫入其中一個文件,我的就是寫入了~/.bash_profile這個文件

然後執行一下:source ~/.bash_profile

最後用 nvm --version 就可以查看已安裝的nvm版本

方法二:

後來我把nvm卸了,想裝一個最新的,但是用 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh|bash 這個命令,一直連不上

按往上說的『先確保https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh是否可以訪問,如果不可訪問,則需要配置hosts文件。通過https://www.ipaddress.com/查詢IP,得到199.232.68.133

hosts文件增加  199.232.68.133 raw.githubusercontent.com』試了,也不行,於是就按官網說的方法手動安裝:

1、cd ~,然後:git clone https://github.com/nvm-sh/nvm.git .nvm

2、cd ~/.nvm,然後:git checkout v0.35.3

3、然後在~/.bash_profile加上以下三句話

exportNVM_DIR="$HOME/.nvm"

[-s"$NVM_DIR/nvm.sh"]&&\."$NVM_DIR/nvm.sh"#This loads nvm

[-s"$NVM_DIR/bash_completion"]&&\."$NVM_DIR/bash_completion"#This loads nvm bash_completion

4、然後執行:source ~/.bash_profile

就裝好了


卸載nvm也很簡單:

1、先移出nvm相關目錄

cd ~

rm -rf .nvm

2、然後移除掉~/.profile, ~/.bash_profile, ~/.zshrc, ~/.bashrc文件中關於nvm的配置(我直接刪掉~/.bash_profile裏的配置即可)

3、重新執行一下配置文件:source ~/.bash_profile


step2:安裝node

使用命令:nvm install node 可以直接安裝

當然也可以用命令:nvm ls-remote 查看遠程node版本號,然後再用命令nvm install [node版本號] 安裝指定的版本

node -v 可查詢安裝的版本

常用命令

nvm list 查看已經安裝的版本

nvm list installed 查看已經安裝的版本

nvm list available 查看網絡可以安裝的版本

nvm version 查看當前的版本

nvm install 安裝最新版本

nvm install <version>:安裝指定版本的node

nvm use <version> ## 切換使用指定的版本node

nvm ls 列出所有版本

nvm current顯示當前版本

nvm alias <name> <version> ## 給不同的版本號添加別名

nvm unalias <name> ## 刪除已定義的別名

nvm reinstall-packages <version> ## 在當前版本node環境下,重新全局安裝指定版本號的npm包

nvm on 打開nodejs控制

nvm off 關閉nodejs控制

nvm proxy 查看設置與代理

nvm node_mirror [url] 設置或者查看setting.txt中的node_mirror,如果不設置的默認是 https://nodejs.org/dist/

nvm npm_mirror [url] 設置或者查看setting.txt中的npm_mirror,如果不設置的話默認的是: https://github.com/npm/npm/archive/.

nvm uninstall <version> 卸載制定的版本

nvm use [version] [arch] 切換制定的node版本和位數

nvm root [path] 設置和查看root路徑


後來想利用nvm降級node版本,結果用nvm ls-remote命令,只有iojs出來,沒有node,百度了好久找到了良方:直接執行一下命令:export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/dist 就可以了。就是我天的各種……


step3:安裝fis

使用命令 npm install -g fis3 進行安裝

fis3 -v 可查詢安裝的版本


step4:安裝fis3-smarty插件

使用命令:npm install -g fis3-smarty 安裝

遇到報錯:rollbackFailedOptional: verb npm-session f1ba88ea03ea69c3

解決方案:更換淘寶鏡像源即可:npm config set registry https://registry.npm.taobao.org

(恢復原有源:npm config set registry http://registry.npmjs.org )


常用命令

1、fis3 server open -->打開web server的根目錄(www目錄)

2、fis3 release   -->將構建結果發佈到web server 的目錄下面

3、fis3 release -d +路徑  -->構建結果發佈到指定的目錄下面

4、fis3 server  start   -->啓動本地web server(瀏覽器將會被打開)

5、fis3 release -w   -->啓動文件監聽功能

6、fis3 release -wl   -->瀏覽器自動刷新

7、fis3 server -h  -->獲取更多參數

8、fis3 server clean  --> 清空web server下面的www目錄

9、fis3 inspect 可以查看每個文件對應分配到的屬性


後來在使用fis插件推代碼的時候,遇到報錯:TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章