1. 程式人生 > >解決Error: ENOENT: no such file or directory, scandir 'D:\IdeaWork\code-front-jet\node_modules\.npmins

解決Error: ENOENT: no such file or directory, scandir 'D:\IdeaWork\code-front-jet\node_modules\.npmins

在使用npm安裝node-sass的時候,可能會出現如下的報錯:

Error: ENOENT: no such file or directory, scandir 'D:\IdeaWork\code-front-jet\node_modules\.npminstall\node-sass\3.7.0\node-sass\vendor'

    at Error (native)

    at Object.fs.readdirSync (fs.js:856:18)

    at Object.getInstalledBinaries (D:\IdeaWork\code-front-jet\node_modules\.npminstall\node-sass\3.7.0\node-sass\lib\extensions.js:74:13)

    at foundBinariesList (D:\IdeaWork\code-front-jet\node_modules\.npminstall\node-sass\3.7.0\node-sass\lib\errors.js:20:15)

    at foundBinaries (D:\IdeaWork\code-front-jet\node_modules\.npminstall\node-sass\3.7.0\node-sass\lib\errors.js:15:5)

    at Object.module.exports.missingBinary (D:\IdeaWork\code-front-jet\node_modules\.npminstall\node-sass\3.7.0\node-sass\lib\errors.js:45:5)

    at Object.<anonymous> (D:\IdeaWork\code-front-jet\node_modules\.npminstall\node-sass\3.7.0\node-sass\lib\index.js:14:28)

    at Module._compile (module.js:413:34)

    at Object.Module._extensions..js (module.js:422:10)

    at Module.load (module.js:357:32)

    at Function.Module._load (module.js:314:12)

    at Module.require (module.js:367:17)

    at require (internal/module.js:16:19)

    at Object.<anonymous> (D:\IdeaWork\code-front-jet\node_modules\.npminstall\gulp-sass\2.2.0\gulp-sass\index.js:186:21)

    at Module._compile (module.js:413:34)

    at Object.Module._extensions..js (module.js:422:10)

解決方案是執行以下方法:

npm rebuild node-sass

問題原因:別問我,我也不知道,貌似是我在github上不知道哪個角落找到的答案, 這個問題很坑。