node.js - 可以在 Vue 3 项目中安装 sass-loader
问题描述
我正在尝试在使用 vue CLI 创建项目之后添加 sass/scss 加载器。我运行了这个脚本:
$ npm install -D sass-loader@^10 sass
我收到以下错误:
npm ERR! notsup Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
它在我为测试它而创建的空项目中对我有用。但在我的项目中不起作用。我使用的是 Ubuntu 20.04,这是我的 package.json 文件:
{
"name": "hikegear",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/vue-fontawesome": "^3.0.0-3",
"chart.js": "^2.9.4",
"core-js": "^3.6.5",
"sortablejs": "^1.13.0",
"vue": "^3.0.5",
"vue-router": "^4.0.3",
"vuedraggable": "^4.0.1",
"vuex": "^4.0.0-rc.2",
"vuex-persistedstate": "^4.0.0-beta.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
解决方案
尝试删除您的package-lock.json
文件和node_modules
文件夹,然后再次安装您的依赖项
rm -r node_modules package.json
npm i
推荐阅读
- javascript - 在 Angular7 中是否存在某种表达 addeventlistener 和 getelementbyId 的方法?
- node.js - 将 MEAN 堆栈应用程序部署到 Heroku 而不加载任何文件?
- pandas - 如果列中的步长值等于 1,则循环条件
- google-apps-script - 选择单个电子邮件而不是整个线程
- java - mvn appengine:stage - 标准环境 - 自动 app.yaml 来自哪里?
- django - 根据 django 中的用户类型重定向到不同页面的登录注册
- sequelize.js - 如何在sequelize中使用多个$or
- java - 我们如何修复导入项目时出现的 spring 配置检查弹出窗口?
- sql - 通过 SQL 在 noSQL 类型文档上从父属性名称创建新属性
- ios - 如何在 Xcode (Swift) 中编码 UI 对象?