我的项目正在运行 node-sass,但我决定将其更改为 sass (dart-sass),因为我想避免安装 python、g++ 而只是为了运行 npm install,而 node-sass 会因为 node-gyp 而强制你这样做.
所以我跑了
$ npm uninstall node-sass
$ npm install sass
运行npm run build
( vue-cli-service build
) 工作正常,但我的持续集成在npm run test:unit
( vue-cli-service test:unit
) 上失败。
这是完整的错误:
FAIL tests/unit/example.spec.ts
● Test suite failed to run[vue-jest]
Error: You are trying to use "scss". node-sass is missing.
To install run:
npm install --save-dev node-sass
at error (node_modules/vue-jest/lib/throw-error.js:2:9)
at module.exports (node_modules/vue-jest/lib/ensure-require.js:38:5) at module.exports (node_modules/vue-jest/lib/compilers/scss-compiler.js:20:3)
at processStyleByLang (node_modules/vue-jest/lib/process-style.js:11:82)
at processStyle (node_modules/vue-jest/lib/process-style.js:20:17)
at node_modules/vue-jest/lib/process.js:93:13
at Array.map (<anonymous>)
at Object.module.exports [as process] (node_modules/vue-jest/lib/process.js:90:8)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 1.265s, estimated 2s
我该怎么做才能修复此错误?我不想回到 node-sass。