ERROR in Cannot find module 'node-sass'(最全解決方案)

目錄

 

一、錯誤描述

二、解決方案

1. 如果你用的是cmd:

2. 如果你用的是Windows Powershell:

總結:建議直接用cmd 


一、錯誤描述

在vue前端項目的開發中,遇到錯誤  ERROR in Cannot find module 'node-sass':

表示找不到node-sass模塊。

是因爲你沒安裝node-sass模塊或者安裝時用的cnpm而不是npm,導致版本過低。

可以通過npm install node-sass 或 cnpm install node-sass@latest 進行安裝。

 

二、解決方案

1. 如果你用的是cmd:

輸入命令 npm install node-sass 或 cnpm install node-sass@latest 直接進行安裝即可。

2. 如果你用的是Windows Powershell:

執行cnpm 命令時,可能會提示下圖的錯誤:

 cnpm : 無法加載文件 C:\Users\hp\AppData\Roaming\npm\cnpm.ps1,因爲在此係統上禁止運行腳本。

 解決方法:
1.
以管理員身份運行power shell
2.
輸入set-ExecutionPolicy RemoteSigned
然後輸入A 回車

(參考:https://blog.csdn.net/qq_36949713/article/details/104247267

總結:建議直接用cmd 

 

 

有問題歡迎來微信找我!

微信搜索:acoolgiser,一起學習成長,交個朋友!^_^

或者直接掃描

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