使用vue cli 3创建新项目后,出现以下错误:
GET http://192.168.1.13:8080/sockjs-node/info?t=1538257166715 net :: ERR_CONNECTION_TIMED_OUT sockjs.js?9be2:1605
作业系统:Windows 10
我知道这似乎是一个重复的问题,在尝试以下操作后,我仍然遇到这种类型的 eslint 错误:
https://github.com/prettier/prettier/issues/3720 (我已经安装了 eslint-plugin-vue)
Vue.js eslint 解析错误。:意外令牌(与我的问题并不真正相关,但我还是尝试了)
这是我的 package.json 设置的一部分:
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.5",
"@vue/cli-plugin-eslint": "^3.0.5",
"@vue/cli-plugin-unit-jest": "^3.0.5",
"@vue/cli-service": "^3.0.5",
"@vue/eslint-config-airbnb": "^4.0.0",
"@vue/test-utils": "^1.0.0-beta.20",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"eslint": "^5.8.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-vue": "^5.0.0-0",
"vue-template-compiler": "^2.5.17"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"@vue/airbnb"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint",
"ecmaVersion": 6
}
},
Run Code Online (Sandbox Code Playgroud)
这是我的.eslintrc.js文件:
module.exports = …Run Code Online (Sandbox Code Playgroud) eslint vue.js airbnb-js-styleguide eslint-config-airbnb vue-cli-3
我使用Vue CLI 3创建了一个新项目(配置为:babel,pwa,eslint,mocha).使用npm run serve工作正常运行测试环境,但我无法构建生产项目.
我安装了当前版本的Vue CLI 3,并尝试使用不同的配置创建项目.构建项目时,我收到以下错误消息.
js/app.bb3f3c6e.js from Terser
TypeError: Cannot read property 'minify' of undefined
at minify (/Users/.../untitled/node_modules/terser-webpack-plugin/dist/minify.js:176:23)
at module.exports (/Users/.../untitled/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
at handle (/Users/.../untitled/node_modules/worker-farm/lib/child/index.js:44:8)
at process.<anonymous> (/Users/.../untitled-adventure/node_modules/worker-farm/lib/child/index.js:51:3)
at process.emit (events.js:188:13)
at emit (internal/child_process.js:828:12)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
Run Code Online (Sandbox Code Playgroud) 我正在创建一个应用程序,并在某个时候需要加载一些数据,但是为了让用户看不到损坏的数据,我正在插入一个加载组件。
目前,我将setTimeout放入了负载中,但是在某些时候,API响应可能会花费超过1秒的时间。因此,我只想在所有调度完成后才更新加载状态。
MainComponent.vue
beforeCreate() {
this.$store.dispatch('responsibles/fetchData')
this.$store.dispatch('events/fetchData')
this.$store.dispatch('wallets/fetchData')
// Need to run this setTimeout after all the above dispatches become completed...
setTimeout(() => {
this.loading = false
}, 1000)
}
Run Code Online (Sandbox Code Playgroud)
store/modules/responsibles.js
const state = {
responsibles: []
}
const actions = {
fetchData({dispatch}) {
function getresponsibles() {
return http.get('responsibles')
}
axios.all([
getresponsibles()
]).then(axios.spread(function (responsibles) {
dispatch('setResponsibles', responsibles.data.data)
})).catch(error => console.error(error))
},
setResponsibles({commit}, responsibles) {
commit('SET_RESPONSIBLES', responsibles)
}
}
const mutations = {
SET_RESPONSIBLES(state, responsibles) {
state.responsibles = responsibles
}
} …Run Code Online (Sandbox Code Playgroud) 我正在使用 Mocha 和 chai 为 vue cli 3 编写单元测试。我试过嘲笑localstorage。但仍然收到此错误 - 'localStorage 未定义'。任何人都可以在这里帮助我吗?
我的代码是这样的 -
import { expect, assert } from 'chai';
import { shallowMount } from '@vue/test-utils';
import LoginComponent from '@/views/LoginComponent.vue';
import Constants from '@/constants';
declare var global: any;
let wrapper;
let componentInstance: any;
let authData;
var mockLocalStorage = {
getItem(key: any) {
if (key === 'access_token') { return '/* a token object */'; }
return 'null';
}
};
describe('LoginComponent.vue', () => {
beforeEach(() => {
global.window = { localStorage: …Run Code Online (Sandbox Code Playgroud) 我安装了带有 PWA 插件和 i18n 的 Vue CLI 3。
我删除了 /public/ 中的所有 Vue 图标文件(包括 /public/img/icons 中的 PNG),删除了 /src/assets 中的 logo.png 文件,删除了 /public/index 中的 link(rel=icon) 标签.html,更改 manifest.json 以删除对现有 Vue 图标文件的任何引用,清除浏览器缓存,但在加载页面时,我仍然在我的 DOM 中获取这些硬编码链接标签:
<link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png">
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png">
<link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87">
<meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png">
Run Code Online (Sandbox Code Playgroud)
这些文件都不存在,也没有在我的项目中的任何地方引用。最奇怪的是,即使删除了所有文件,默认的 Vue 图标仍然显示在我使用的任何浏览器中,所以它绝对不是客户端缓存的东西。
我怎样才能删除这些?
我有一个项目已经完美运行了几个月,可以npm run serve毫无问题地运行。每当我切换网络时,我都必须终止并再次运行命令,但这从来都不是问题,服务器总是可以重新启动。
直到现在 - 无论我做什么,我都无法启动服务器。我收到此错误:
npm run serve
> xbs@0.6.2 serve D:\workspace\[PROJECT]
> vue-cli-service serve
INFO Starting development server...
10% building 1/1 modules 0 active ERROR TypeError: Cannot read property 'upgrade' of undefined
TypeError: Cannot read property 'upgrade' of undefined
at Server.<anonymous> (D:\workspace\[PROJECT]\node_modules\webpack-dev-server\lib\Server.js:667:47)
at Array.forEach (<anonymous>)
at new Server (D:\workspace\[PROJECT]\node_modules\webpack-dev-server\lib\Server.js:666:22)
at serve (D:\workspace\[PROJECT]\node_modules\@vue\cli-service\lib\commands\serve.js:137:20)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
Run Code Online (Sandbox Code Playgroud)
我最后一次收到这条消息是在我忘记设置.env文件时,但这是一个以前的工作副本,其中设置了所有必需的文件,自上次工作运行以来没有任何更改。
我什至尝试过提取 repo 的新副本,运行npm i并设置所有 …
我已经安装了vue-cli 3.5.5。当我跑步时vue create myapp,它显示消息Update available 3.6.2。
Vue CLI v3.5.5
?????????????????????????????
? Update available: 3.6.2 ?
?????????????????????????????
Run Code Online (Sandbox Code Playgroud)
如何将vue-cli升级到最新版本?
运行时,npm i -g vue-cli它将安装vue-cli版本2.9.6,而不是升级现有的vue cli版本。
作业系统:Ubuntu 18.04.1。
节点版本:10.15.3。
nvm版本:0.34.0。
我正在使用电子和 vue构建一个桌面应用程序,一切正常,在开发模式下运行该应用程序并通过运行构建它直到最后一个构建,electron:build但我不断收到Octal 转义序列的错误。
我很确定它必须处理strict mode,但我试图找到 ocatal 转义但没有机会,我试图删除一些无用的依赖项,我在上次成功构建后添加的也没有工作
PS:电子:服务工作正常
错误图片
模板字符串中不允许来自 Terser Octal 转义序列的 background.js [background.js:1026,68555]
错误 构建失败并出现错误。npm 错误!代码 ELIFECYCLE npm ERR!错误号 1 npm 错误号!键盘管理
vue-cli-service electron:build@0.1.0电子:构建:npm ERR!退出状态 1 npm ERR!npm 错误!在键盘管理@0.1.0 电子:构建脚本失败。npm 错误!这可能不是 npm 的问题。上面可能有额外的日志输出。
I just started to use vue-cli and I got stock with a problem.
Following the Docs instructions:
npm install -g @vue/cli (version 3.11.0).I created a project vue create test (default config) and cd into the folder.
But when I tried to build the project npm run build, I got this error.
TypeError: Cannot read property 'name' of undefined
at entrypoint.getFiles.reduce (C:\Users\MyUser\test\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:43:25)
at Array.reduce (<anonymous>)
at getEntrypointSize (C:\Users\MyUser\test\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:40:27)
at compiler.hooks.afterEmit.tap.compilation (C:\Users\MyUser\test\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:75:18)
at _next0 (eval at create …Run Code Online (Sandbox Code Playgroud)