npm報錯 TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string.Received undefine

若相知丶發表於2020-12-23

npm報錯 TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string.Received undefined

解決辦法:

1.修改static資料夾下的package.json裡sass-loader版本

"sass-loader": "^7.3.1"

2.重新npm install

3.npmrun dev

4.遇到了新的錯誤

Node Sass version 5.0.0 is incompatible with^4.0.0

此錯誤來自sass-loader。因為node-sass @latest為v5.0.0,而sass-loader期望值為^ 4.0.0。
5.解除安裝5.0 重灌4.x

# 解除安裝node-sass
npm uninstall node-sass
# 安裝4.x版本(5.0之前)
npm install node-sass@4.14.1

6.npmrun dev

7.成功解決問題

相關文章