Closed 3rd closed 4 years ago
This fixes it for now:
"vetur.validation.template": false,
Hey, it's not a fix, just a way to stop it from completely breaking.
I'm having the exact same issue. Cannot use vetur at all. IntelliSense comes up but hitting tab, enter space does absolutely nothing.
Here are the steps I took to try to resolve this issue.
Is this a problem with coc-vetur or with coc itself? Maybe the CocInstall somehow failed to correctly install coc-vetur?
Run npm install --production --ignore-scripts
in folder of coc-vetur.
I've ran npm install --production --ignore-scripts
in the coc-vetur folder. Everything finished without any errors. There is now a index.ts
file in the lib folder.
I tested vetur with 2 projects, one that does have eslint installed locally and one that does not. Vetur works just like expected with ZERO errors in the project with eslint.
Thank you for your help.
Hi, sorry to bother.
This problem happens here. I tried the method above (i.e., remove node_modules
and run npm install --production --ignore-scripts
in coc-vetur folder).
But it doesn't work. Some logs FYR.
/home/xx/.config/coc/extensions/node_modules/coc-vetur/node_modules/eslint/lib/cli-engine/config-array/config-array.js:180
throw sourceValue.error;
^
Error: Failed to load plugin 'vue' declared in 'CLIOptions': Cannot find module 'eslint-plugin-vue'
Require stack:
- /home/xx/aaa/__placeholder__.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1020:15)
at Function.resolve (internal/modules/cjs/helpers.js:78:19)
at Object.resolve (/home/xx/.config/coc/extensions/node_modules/coc-vetur/node_modules/eslint/lib/shared/relative-module-resolver.js:44:50)
at ConfigArrayFactory._loadPlugin (/home/xx/.config/coc/extensions/node_modules/coc-vetur/node_modules/eslint/lib/cli-engine/config-array-factory.js:959:39)
at /home/xx/.config/coc/extensions/node_modules/coc-vetur/node_modules/eslint/lib/cli-engine/config-array-factory.js:848:33
at Array.reduce (<anonymous>)
at ConfigArrayFactory._loadPlugins (/home/xx/.config/coc/extensions/node_modules/coc-vetur/node_modules/eslint/lib/cli-engine/config-array-factory.js:844:22)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/xx/.config/coc/extensions/node_modules/coc-vetur/node_modules/eslint/lib/cli-engine/config-array-factory.js:667:32)
at _normalizeObjectConfigDataBody.next (<anonymous>)
at ConfigArrayFactory._normalizeObjectConfigData (/home/xx/.config/coc/extensions/node_modules/coc-vetur/node_modules/eslint/lib/cli-engine/config-array-factory.js:596:20) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/xx/aaa/__placeholder__.js' ],
messageTemplate: 'plugin-missing',
messageData: {
pluginName: 'eslint-plugin-vue',
resolvePluginsRelativeTo: '/home/xx/aaa',
importerName: 'CLIOptions'
}
}
@jjs1015 use :CocList extensions
to check extension folder.
@jjs1015 use
:CocList extensions
to check extension folder.
Not sure if I get your point. Did you mean this?
Besides, tree -I node_modules -h
in ~/.config/coc/extensions/node_modules/coc-vetur
:
.
├── [4.0K] lib
│ └── [194K] index.js
├── [ 10K] package.json
├── [324K] package-lock.json
├── [4.3K] Readme.md
└── [ 686] webpack.config.js
and ls node_modules
(I can find eslint-plugin-vue
in ~/.config/coc/extensions/node_modules/coc-vetur/node_modules
):
@babel core-util-is has-yarn lowercase-keys punycode through
@emmetio cross-spawn hast-util-embedded lru-cache quick-lru tmp
@mrmlnc crypto-random-string hast-util-has-property make-dir rc to-object-path
@nodelib css hast-util-is-body-ok-link map-age-cleaner read-pkg to-readable-stream
@sindresorhus css-parse hast-util-is-element map-cache read-pkg-up to-regex
@sorg csstype hast-util-parse-selector map-obj readable-stream to-regex-range
@starptech currently-unhandled hast-util-to-string map-visit readdirp to-vfile
@szmarczak debug hast-util-whitespace markdown-table redent trim
@types decamelize hosted-git-info mem regex-not trim-newlines
@typescript-eslint decamelize-keys html-void-elements meow regexpp trim-trailing-lines
abbrev decode-uri-component html-whitespace-sensitive-tag-names merge2 registry-auth-token trough
acorn decompress-response http-cache-semantics micromatch registry-url tslib
acorn-jsx deep-extend iconv-lite mimic-fn rehype-sort-attribute-values tslint
aggregate-error deep-is ignore mimic-response remark tsutils
ajv defaults import-fresh minimatch remark-parse type-check
ansi-align defer-to-connect import-lazy minimist remark-stringify type-fest
ansi-escapes define-property imurmurhash minimist-options repeat-element typedarray
ansi-regex del indent-string mixin-deep repeat-string typescript
ansi-styles del-cli inflight mkdirp replace-ext unherit
anymatch diff inherits mout require-directory unified
argparse dir-glob ini ms require-main-filename unified-engine
arr-diff dlv inquirer mute-stream require-relative union-value
arr-flatten doctrine invert-kv nanomatch resolve unique-string
arr-union dot-prop is-accessor-descriptor natural-compare resolve-from unist-util-find
array-find-index duplexer3 is-alphabetical nice-try resolve-url unist-util-inspect
array-iterate editorconfig is-alphanumerical node-fetch responselike unist-util-is
array-union element-helper-json is-arrayish nopt restore-cursor unist-util-modify-children
array-uniq emoji-regex is-binary-path normalize-package-data ret unist-util-remove-position
array-unique end-of-stream is-buffer normalize-path reusify unist-util-stringify-position
arrify error-ex is-ci normalize-url rimraf unist-util-visit
assign-symbols escape-string-regexp is-data-descriptor npm-prefix run-async unist-util-visit-parents
astral-regex eslint is-decimal npm-run-path run-parallel unset-value
async eslint-plugin-vue is-descriptor number-is-nan rxjs untildify
atob eslint-scope is-empty nuxt-helper-json s.color update-notifier
bail eslint-utils is-extendable object-assign safe-buffer uri-js
balanced-match eslint-visitor-keys is-extglob object-copy safe-regex urix
base espree is-fullwidth-code-point object-visit safer-buffer url-parse-lax
binary-extensions esprima is-glob object.pick sass-formatter use
bootstrap-vue-helper-json esquery is-hexadecimal once sax user-home
boxen esrecurse is-hidden onetime semver util-deprecate
brace-expansion estraverse is-installed-globally optionator semver-diff v8-compile-cache
braces esutils is-npm os-homedir set-blocking validate-npm-package-license
buefy-helper-json execa is-number os-locale set-value vfile
buffer-from expand-brackets is-obj os-tmpdir shebang-command vfile-location
builtin-modules extend is-object osenv shebang-regex vfile-message
cache-base extend-shallow is-path-cwd p-cancelable shellsubstitute vfile-reporter
cacheable-request external-editor is-path-inside p-defer sigmund vfile-sort
call-me-maybe extglob is-plain-obj p-finally signal-exit vfile-statistics
callsites fast-deep-equal is-plain-object p-is-promise slash vls
camelcase fast-glob is-stream p-limit slice-ansi vscode-css-languageservice
camelcase-keys fast-json-stable-stringify is-utf8 p-locate snapdragon vscode-emmet-helper
ccount fast-levenshtein is-windows p-map snapdragon-node vscode-jsonrpc
chalk fastq is-yarn-global p-try snapdragon-util vscode-languageserver
character-entities fault isarray package-json source-map vscode-languageserver-protocol
character-entities-html4 figures isexe parent-module source-map-resolve vscode-languageserver-textdocument
character-entities-legacy file-entry-cache isobject parse-entities source-map-url vscode-languageserver-types
character-reference-invalid fill-range js-beautify parse-gitignore space-separated-tokens vscode-nls
chardet find-up js-tokens parse-json spdx-correct vscode-uri
chokidar flat-cache js-yaml pascalcase spdx-exceptions vscode-web-custom-data
ci-info flatted json-buffer path-dirname spdx-expression-parse vue-eslint-parser
class-utils fn-name json-parse-better-errors path-exists spdx-license-ids vue-onsenui-helper-json
clean-stack for-in json-schema-traverse path-is-absolute split-string wcwidth
cli-boxes format json-stable-stringify-without-jsonify path-is-inside sprintf-js which
cli-cursor fragment-cache json5 path-key stampit which-module
cli-width fs.realpath jsonc-parser path-parse static-extend widest-line
cliui function-bind keyv path-type string-width window-size
clone functional-red-black-tree kind-of picomatch string_decoder word-wrap
clone-response get-caller-file latest-version pify stringify-entities wrap-ansi
code-point-at get-stream lcid pinkie strip-ansi wrappy
collapse-white-space get-value levn pinkie-promise strip-bom write
collection-visit glob lines-and-columns pkg-conf strip-eof write-file-atomic
color-convert glob-parent load-json-file posix-character-classes strip-indent x-is-array
color-name glob-to-regexp load-plugin prelude-ls strip-json-comments x-is-string
columnify global-dirs locate-path prepend-http stylint xdg-basedir
comma-separated-tokens globals lodash prettier stylus xtend
commander globby lodash.assign prettier-eslint stylus-supremacy y18n
common-tags got lodash.defaults prettier-tslint suf-cli yallist
component-emitter graceful-fs lodash.iteratee pretty-format suf-node yargs
concat-map gridsome-helper-json lodash.merge process-nextick-args suf-regex yargs-parser
concat-stream has lodash.unescape progress supports-color
config-chain has-ansi loglevel property-information symbol
configstore has-flag loglevel-colored-level-prefix proto-list table
copy-descriptor has-value longest-streak pseudomap term-size
core-js has-values loud-rejection pump text-table
messageData: {
pluginName: 'eslint-plugin-vue',
resolvePluginsRelativeTo: '/home/xx/aaa',
importerName: 'CLIOptions'
}
Looks like the module is resolved from your project, you have to install it as devDependency.
messageData: { pluginName: 'eslint-plugin-vue', resolvePluginsRelativeTo: '/home/xx/aaa', importerName: 'CLIOptions' }
Looks like the module is resolved from your project, you have to install it as devDependency.
Fixed by installing eslint
and eslint-plugin-vue
as devDepndency.
I thought they are the dependencies of coc-vetur. Anyway, it works now, thx!
they are the dependencies of coc-vetur
Yes, but I don't know why coc-vetur resolve eslint-plugin-vue from your local node_modules, maybe you have eslint as devDependency.
This solution proposed by @chemzqm is the best, it doesn't have any drawbacks. Your templates can be linted by coc-eslint instead.
"vetur.validation.template": false,
It prevents coc-vetur from using eslint-plugin-vue to lint the templates and from crashing. To get your templates linted by coc-eslint you need to install and configure eslint and eslint-plugin-vue for your project, but let me repeat that your templates will still get linted.
In my case resolvePluginsRelativeTo
was defined as my project directory and couldn't find a way to change it. I suspect that it has to do with eslint pushing for local project configuration and plugin resolution.
It was problematic because I usually work on serveral projects at the same time in different tabs. If I opened nvim or restarted coc on a project that doesn't use vue, vetur would crash. Also I couldn't install eslint-plugin-vue or eslint as a devDependency on projects that have nothing to do with vue.
Change ~/.config/coc/extensions/node_modules/coc-vetur/node_modules/vls/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js
L193-203 to
constructor({
additionalPluginPool = new Map(),
baseConfig: baseConfigData = null,
cliConfig: cliConfigData = null,
cwd = process.cwd(),
ignorePath,
resolvePluginsRelativeTo = '/Users/xiongliding/.config/coc/extensions/node_modules/coc-vetur', // from var cwd to the coc-vetur dir
rulePaths = [],
specificConfigPath = null,
useEslintrc = true
} = {}) {
solve the problem too, template lint works;
just replace
resolvePluginsRelativeTo = cwd,
with
resolvePluginsRelativeTo = '/Users/xiongliding/.config/coc/extensions/node_modules/coc-vetur',
So at least we know it use the default value. if there is no bug in eslint, the problem is caused by both coc-vetur and vls don't pass a param resolvePluginsRelativeTo
into it.
Don't change the code of eslint, you should install eslint
and eslint-plugin-vue
as devDependencies of your project and start vim your project root.
Yes, of course. Just want it works with the isolate .vue file, also provides some information.
I think coc-vetur
absolutely known where the eslint-plugin-vue
is.
Maybe coc-vetur
should add an option to tell vls
to tell eslint
where to find eslint-plugin-vue
It's problem of vls, it's not controlled by coc-vetur.
Hello,
coc-vetur
throws this error when opening a Vue file (with TS):I tried installing the eslint plugin manually, but that didn't work out. Did anyone else encouter this?