快速刪除node modules的方法

2022-03-07 23:21:25 字數 567 閱讀 2705

前端開發過程中,經常會遇到npm操作問題,有時候不得不需要刪除node_modules目錄下所有的檔案,然後重新npm install。但是當依賴包很多的時候,每次手動刪除node_modules都需要5分鐘以上,太浪費寶貴的時間啦,另外還可能遇到需要許可權,點選同意,還是刪除失敗,只能在每個資料夾下刪除內容,再刪除外部的資料夾。

於是,找到了各種便捷快速的方法:

第一種(最方便,刪除速度超快):

npm install rimraf -g

rimraf node_modules

第二種:

/s 是代表刪除所有子目錄跟其中的檔案。 

/q 是不要它在刪除檔案或目錄時,不再問我 yes or no 的動作。 

要刪除的目錄前也可以指定路徑,如: rmdir /s/q d:\123\abc 

第三種:

rm -f /node_modules

第四種:

npm install -g dlf 

dlf c:\users\

92809\desktop\12

快速刪除node modules

解決方法 使用npm的乙個名為rimraf的模組進行刪除 官方描述 the unix commandrm rffor node,即node環境下模擬unix或者linux下的rm rf 強制刪除命令 使用 cd the folder which includes node modules folde...

快速刪除node modules資料夾

解決方法 使用npm的乙個名為rimraf的模組進行刪除 官方描述 the unix commandrm rffor node,即node環境下模擬unix或者linux下的rm rf 強制刪除命令 使用 cd the folder which includes node modules folde...

快速刪除node modules資料夾

分類專欄 node npm 解決方法 使用npm的乙個名為rimraf的模組進行刪除 官方描述 the unix commandrm rffor node,即node環境下模擬unix或者linux下的rm rf 強制刪除命令 使用 cd the folder which includes node...