刚刚将包添加normalize-scss到我的新 Vue 项目中,但没有应用任何样式......我都尝试过:
@import 'normalize-scss' 在我的 styles.scss
import 'normalize-scss'在我的main.js页面
难道我做错了什么?该包显然存在,因为该应用程序在运行,但它实际上并未应用任何 css 规则。
我正在尝试添加 cssnano 优化规则,但是使用 vue-cli,它似乎不起作用。我在中添加了以下脚本vue.config.js:
module.exports = {
css: {
loaderOptions: {
postcss: {
plugins: [
require("cssnano")({
preset: [
"default",
{
discardComments: {
removeAll: true
},
mergeRules: true
}
]
})
]
}
}
}
};
Run Code Online (Sandbox Code Playgroud)
但它不起作用(见下面的截图)
屏幕截图 - cssnanomergeRules不适用:
我错过了什么?
我有节点 11.2.0
继续收到此错误。
Andrews-MacBook-Pro:vueTutorial aharris$ npm install -g @vue/cli
npm WARN deprecated hoek@5.0.4: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN @apollographql/apollo-upload-server@5.0.3 requires a peer of graphql@^0.13.1 but none is installed. You must install peer dependencies yourself.
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall …Run Code Online (Sandbox Code Playgroud) 我在这方面有点新,这是我的第一个问题。我问你,因为我无法解决这个问题 2-3 天,即使在阅读了很多关于这个问题的材料之后也没有解决。我发现了什么:
我像这样使用npmas初始化我的 vue webpack 项目vue init webpack
完成后,我更改host: 'localhost'为host: '0.0.0.0',并添加disableHostCheck: true。
在config/index.js开发范围内,我用 -> 启动我的服务器npm run dev
输出:
Compiled successfully in 3070ms
Your application is running here: http://0.0.0.0:8080
Run Code Online (Sandbox Code Playgroud)
如果我用 :8080 在浏览器中输入我的 Ipv4 地址,就像xxx.xxx.xxx.xxx:8080我的项目在那里一样。没关系,但我无法从其他设备(例如笔记本电脑或手机)上查看我的项目。
我不太明白这一点,因为我读到如果我们在主机上输入“0.0.0.0”,这意味着每个人都可以访问 LAN 上的项目。
有人能告诉我为什么会这样吗?
我试图安装 vue-cli 使用
npm install -g @vue/cli
我收到以下错误
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/moeketsi/.npm/_cacache/tmp'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /home/moeketsi/.npm/_logs/2019-08-02T07_16_39_683Z-debug.log
Run Code Online (Sandbox Code Playgroud)
日志文件可在此处获得。
当我尝试运行命令时,sudo我得到
sudo: npm: command not found
Run Code Online (Sandbox Code Playgroud)
我正在使用 node v10.16.1 并且 npm 版本是 6.9.0 。我安装了他们的node.js的网站。我尝试了这篇文章中的以下建议,也许是一个 稍微不同的案例,但这些建议都没有帮助。
我使用 vuetify 最新版本。我遵循本教程https://vuetifyjs.com/en/getting-started/quick-start
在 vue 组件中,我尝试这样:
<v-text-field
append-icon="mic"
class="mx-4"
flat
hide-details
label="Search"
prepend-inner-icon="search"
solo-inverted
></v-text-field>
Run Code Online (Sandbox Code Playgroud)
结果是这样的:
在我的 public/index.html 像这样:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>msm-website-appointment</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head>
<body>
<noscript>
<strong>We're sorry but msm-website-appointment doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
看起来设计材料已加载。但为什么没有出现图标?
我的应用程序正确包装,<v-app>并且我的 vuetify 选项在开发模式下正常工作,或者如果我正常构建使用vue-cli-service build例如。
Vue.use(Vuetify, {
iconfont: 'fa',
theme: {
primary: '#213e79',
secondary: '#c0d8ed',
accent: '#4ea3ed',
error: '#b71c1c',
info: '#2196f3',
success: '#66bb6a',
warning: '#f57f17'
}
});
Run Code Online (Sandbox Code Playgroud)
但是,如果我以库模式构建(例如:)vue-cli-service build --target lib --name xxx,则不会考虑上述选项。vuetify/dist/vuetify.js由于缺乏更好的解决方案,我被迫修改..
知道可能是什么问题吗?如果你们中有人有解决方法,那就太好了:)
有没有办法追踪这种构建问题?即会显示更详细的错误信息的标志?我的项目非常像默认的 vue cli 项目。直到今天早上,它已经运行了好几个月。
$ vue-cli-service build --mode dev
? Building for dev...
ERROR Failed to compile with 0 errors 12:06:07 PM
ERROR Build failed with errors.
error Command failed with exit code 1.
Run Code Online (Sandbox Code Playgroud) 我正在尝试对节点模块使用 sass 加载器。但无论我尝试什么,都会出现以下错误:
SassError:找不到要导入的样式表。
我的 vue.config.js 看起来像这样:
module.exports = {
css: {
sourceMap: true,
loaderOptions: {
scss: {
prependData: `
@import "~@/my-node-module/theme/engine.scss";
`
}
}
},
};
Run Code Online (Sandbox Code Playgroud) vue-cli ×10
vue.js ×9
node.js ×3
webpack ×3
npm ×2
sass ×2
vue-cli-3 ×2
vuetify.js ×2
cssnano ×1
javascript ×1
sass-loader ×1
vue-cli-4 ×1
yarnpkg ×1