如何安装node-sass模块以在项目中运行?我收到错误消息“找不到模块'sass'”

时间:2019-01-12 15:50:23

标签: npm node-modules node-sass

node-sass模块在我的package.json中描述为devDepedencies部分。

但是当我运行npm run prod时,我得到一个错误

    Error: Cannot find module 'sass'
        at Function.Module._resolveFilename (module.js:538:15)
        at Function.Module._load (module.js:468:25)
        at Module.require (module.js:587:17)
        at require (/home/dev/www/trackremont/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
        at implementation (/home/dev/www/trackremont/node_modules/laravel-mix/src/components/Sass.js:52:39)
        at implementation (/home/dev/www/trackremont/node_modules/laravel-mix/src/components/Preprocessor.js:125:61)
        at global.tap (/home/dev/www/trackremont/node_modules/laravel-mix/src/helpers.js:10:5)
        at Sass.loaderOptions (/home/dev/www/trackremont/node_modules/laravel-mix/src/components/Preprocessor.js:123:9)
   ...
    npm ERR! @ production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the @ production script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

试图执行清洁命令

    rm -rf node_modules &&
    rm package-lock.json
    npm cache verify
    npm cache clear --force &&
    npm run prod

但错误仍然存​​在

请帮忙。

0 个答案:

没有答案