sass 编译错误

来源:3-3 方案二:使用vue-cli创建uni-app项目

慕虎5224321

2021-12-28 19:31:35

老师你好,我用 vue-cli 创建 uni-app 项目时候 出现以下错误:

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.


gyp: No Xcode or CLT version detected!

gyp ERR! configure error 

gyp ERR! stack Error: `gyp` failed with exit code: 1

gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)

gyp ERR! stack     at ChildProcess.emit (events.js:315:20)

gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)

gyp ERR! System Darwin 19.6.0

gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

gyp ERR! cwd /Users/robin/git/big-front-end/community-wx/community-wx/node_modules/webpack-dev-server/node_modules/fsevents

gyp ERR! node -v v14.16.0

gyp ERR! node-gyp -v v5.1.0

gyp ERR! not ok 

 

最终项目创建好了,但是 使用 lang="scss" 时候报以下错误,我猜这个错误是由上面的错误引起的。所以把上面的错误列出来了。但是我在后来重新安装 node-sass 和 sass-loader 安装顺利,但是项目还是报 以下node 错误。

error  in ./src/App.vue?vue&type=style&index=0&lang=scss&


ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.

 - options has an unknown property 'additionalData'. These properties are valid:

   object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }

想问下这个错误可能哪里引起的呢?另外碰到这样的错误是不是需要删除项目,重新用 vue-cli 创建呢? 谢谢老师!


写回答

1回答

Brian

2021-12-29

应该是sass版本的问题,把sass降版本


npm i -D sass@8 或者sass@7看看

0

大前端2022版

1个业务场景打通全端、全栈、全流程,实现全局思维与综合技术能力全面突破;对标阿里P6,8个月成为前端高级人才

2840 学习 · 691 问题

查看课程