neoclide / coc-vetur

Vue language server extension for coc.nvim
219 stars 7 forks source link

Module not found - 'vscode-css-languageservice/lib/umd/data/browsers' #28

Closed jbalzar closed 4 years ago

jbalzar commented 4 years ago

Hello! I just installed the extension but I'm getting issue. I'm not sure if this is related to the current extension but this is the output when I run :CocCommand workspace.showOutput

Error: Cannot find module 'vscode-css-languageservice/lib/umd/data/browsers' Require stack:

jbalzar commented 4 years ago

I manage to fix it by editing directly the file in the package that is giving an issue.

~/.config/coc/extensions/node_modules/coc-vetur/node_modules/vue-language-server/dist/modes/style/stylus/css-browser-data.js

from: const rawData = require('vscode-css-languageservice/lib/umd/data/browsers').cssData; to: const rawData = require('vscode-css-languageservice/lib/umd/data/webCustomData').cssData;

I just rename the "browser" to "webCustomData".

Do you have any idea?

Thanks

chemzqm commented 4 years ago

No, can't reproduce.

jbalzar commented 4 years ago

Ok. I guess I'll leave it for now. Thanks!

gglynne commented 4 years ago

i can confirm the same issue with version 1.1.7

kthibodeaux commented 4 years ago

Having the same issue, uninstalling all extensions and reinstalling just vetur still causes the issue. When I open a vue file and run :CocInfo I see the same stack trace.

jbalzar commented 4 years ago

@chemzqm Maybe you can take a look again?

chemzqm commented 4 years ago

Don't know what happened with vue-language-server, it doesn't start at all with latest version.

heroheman commented 4 years ago

I manage to fix it by editing directly the file in the package that is giving an issue.

~/.config/coc/extensions/node_modules/coc-vetur/node_modules/vue-language-server/dist/modes/style/stylus/css-browser-data.js

from: const rawData = require('vscode-css-languageservice/lib/umd/data/browsers').cssData; to: const rawData = require('vscode-css-languageservice/lib/umd/data/webCustomData').cssData;

I just rename the "browser" to "webCustomData".

Do you have any idea?

Thanks

Had the same issue - worked for me. Looking forward to a fix!

yaegassy commented 4 years ago

This is a vue-language-server dependency bug.

See: https://github.com/vuejs/vetur/pull/1730

Unfortunately, you will have to wait for the npm package to be updated.

yaegassy commented 4 years ago

@chemzqm

It seems that vue-language-server has been changed to vls.

See: https://github.com/vuejs/vetur/releases/tag/v0.24.0

vue-language-server deprecated and will be published as vls.

npm: https://www.npmjs.com/package/vls

StrayDragon commented 4 years ago

As @yaegassy said, some upstream changes have replaced the old language server, Now we have to switch to the new package and so far my solution is:

  1. Install the new vls:
    $ yarn global add vls
  2. Get the vls root path:
    $ yarn global dir
    /home/<USER_NAME>/.config/yarn/global # like this, then join with /node_modules/vls
  3. Add this config to :CocConfig (Replace it with your vls path)
"vetur.dev.vlsPath": "/home/<USER_NAME>/.config/yarn/global/node_modules/vls",

Finally, I found that there are some deprecation warnings, but it works!

My :CocInfo:

## versions

vim version: NVIM v0.5.0-400-gad745f9da
node version: v12.16.1
coc.nvim version: 0.0.76-f4400f58ef
term: xterm-256color
platform: linux

...

## Output channel: vetur

Loaded bundled typescript@3.8.3.
Vetur initialized
{ parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }.
yaegassy commented 4 years ago

@chemzqm Created PR to change from vue-language-server package to vls package.

Herz3h commented 4 years ago

Same problem here. I can confirm @StrayDragon worked.