發佈日期: 發佈留言

npm 指令介紹

跑專案時,會需要用到的 npm 指令。

# npm install、npm i

安裝 node_modules 資料夾、更新套件

# npm update

一次更新專案中的所有套件

# npm update -g

加入 -g 參數,更新全域套件

# npm uninstall 套件名稱

以解除安裝 express 套件範例,npm uninstall express
使用 -g 安裝的套件,刪除時也必須加入 -g 參數,npm uninstall express -g

# php artisan key:generate

如一開始沒有 .env 檔案,可由此下載 ,如果沒有 key 則需透過 artisan 產生一組網站專屬密鑰用來確保 session、password 等加密資料安全性

# npm run watch

編寫程式邊編譯

# npm run dev

編譯,用於開發環境、並不會壓縮檔案

# npm run prod

編譯,用於實際上線、會壓縮檔案,檔案越小網頁載入速度越快。

# rm -f /node_modules

刪除 node_modules 資料夾

# npm install -g n stable

升級 node 到穩定版,要有權限才能升級

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *