我正面临一个奇怪的错误,当我安装引导。错误如下。我尝试卸载less-loader并安装less-loader@5.0.0,因为我在网上看到了它,但它什么都没有。我不确定在这一步该做什么。
TypeError:这个。getOptions不是一个函数
@ ./node_modules/vue-style-loader??ref--8-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!./node_modules/vue-loader-v16/dist/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=scss 4:14-419 14:3-18:5 15:22-427
@ ./src/App.vue?vue&type=style&index=0&id=7ba5bd90&lang=scss
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.1.182:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
我们遇到了不同版本的问题,下面的组合是可行的:
文件:package.json
{
"devDependencies": {
"webpack": "^4.46.0",
"css-loader": "^5.1.1",
"babel-loader": "8.1.0",
"file-loader": "^6.1.0",
"json-loader": "^0.5.7",
"postcss-loader": "^6.2.1",
"raw-loader": "^4.0.1",
"sass-loader": "^12.6.0",
"source-map-loader": "^3.0.1",
"style-loader": "^3.3.1",
"svg-url-loader": "^6.0.0",
"ts-loader": "^5.3.3",
"url-loader": "^4.1.1"
}
}
文件:webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/,
loader: "css-loader",
}
]
}
}
这为我解决了类似Sass的问题:
添加到包中。“sass-loader”:“7.3.1”
npm i -D sass或yarn添加sass——dev
删除node_modules
NPM install或yarn取决于你的包管理器
我的配置:
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.32.6",
"sass-loader": "7.3.1",
"vue-template-compiler": "^2.6.11"
},
我们遇到了不同版本的问题,下面的组合是可行的:
文件:package.json
{
"devDependencies": {
"webpack": "^4.46.0",
"css-loader": "^5.1.1",
"babel-loader": "8.1.0",
"file-loader": "^6.1.0",
"json-loader": "^0.5.7",
"postcss-loader": "^6.2.1",
"raw-loader": "^4.0.1",
"sass-loader": "^12.6.0",
"source-map-loader": "^3.0.1",
"style-loader": "^3.3.1",
"svg-url-loader": "^6.0.0",
"ts-loader": "^5.3.3",
"url-loader": "^4.1.1"
}
}
文件:webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.css$/,
loader: "css-loader",
}
]
}
}
我已经添加了这些行,我的代码工作正常,
请尝试此操作,并相应地添加或删除您的软件包和版本。
"dependencies": {
"core-js": "^3.6.5",
"node-sass": "^7.0.1",
"sass-resources-loader": "^2.1.0",
"vue": "^3.0.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.13",
"@vue/cli-plugin-eslint": "~4.5.13",
"@vue/cli-service": "~4.5.13",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^7.0.0",
"node-sass": "^4.14.1",
"prettier": "^1.19.1",
"sass-loader": "^10.0.2",
"vue-template-compiler": "^2.6.11"
},