neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.47k stars 954 forks source link

compiled javascript file not found #651

Closed emrahc closed 5 years ago

emrahc commented 5 years ago

I installed coc.nvim but cant run it. Previously it was working , nomore after new linux install(solus 4) Yarn is in my path.

I runned :checkhealth got an advice;

:!yarn install --frozen-lockfile
yarn install v1.13.0 [1/4] Resolving packages... success Already up-to-date. $ yarnpkg clean && yarnpkg build /bin/sh: yarnpkg: nocommand error Command failed with exit code 127. info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

shell returned 1 [coc.nvim] compiled javascript file not found!

chemzqm commented 5 years ago

yarnpkg should comes with yarn command, have no idea why it's missing.

paldepind commented 5 years ago

@emrahc When you install Yarn you should get a yarnpkg in your path. If you do not have yarnpkg in you path then that is a problem with how you installed Yarn. If, for instance, you installed it through Solus then it is a problem with the Solus Yarn package.

chemzqm commented 5 years ago

No need to compile the code yourself, use ./install.sh nightly command to download lastest build file is recommended.

ewanjones commented 5 years ago

I'm also having this problem when installing on MacVim version 8.1 using Vundle. My .vimrc has Plugin 'neoclide/coc.nvim', {'branch': 'release'} but when running :PluginInstall I get the error [coc.nvim] compiled javascript file not found! (and every time I run vim).

I've tried installing the latest node (v10.16.0) and yarn and yarn is in my path.

chemzqm commented 5 years ago

@emrahc remove let g:coc_force_debug = 1 in your vimrc, since there's no compiled javascript with release branch, you have to build from master branch to use it.

ewanjones commented 5 years ago

@chemzqm I don't have that set and I've tried installing with Plugin 'neoclide/coc.nvim', {'branch': 'release'} and without the release branch. Is it an issue with Vundle do you think?

EDIT: Copying a friend's config (below) gives me a slightly different error: [coc.nvim] javascript file not found, please compile the code or use release branch.

Plugin 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
Plugin 'neoclide/coc-python', {'do': 'yarn install --frozen-lockfile'}
Plugin 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'}
Plugin 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile'}
Plugin 'neoclide/coc-highlight', {'do': 'yarn install --frozen-lockfile'}

Again adding 'branch': 'release' still produces the error after clean and install

chemzqm commented 5 years ago

@emrahc Don't know if it's issue of vundle, it's not well maintained for a long time, but it's clear that you don't have compiled javascript. Use git symbolic-ref -q HEAD to checkout current branch.

godenji commented 5 years ago

@emrahc did you manage to sort this out? Same issue on Fedora 30 + Vundle.

emrahc commented 5 years ago

@emrahc did you manage to sort this out? Same issue on Fedora 30 + Vundle.

The problem was installing Yarn from repo.The yarn packages in some linux repos are kinda broken and old. I installed directly from yarn site and its solved.

godenji commented 5 years ago

The problem was installing Yarn from repo.The yarn packages in some linux repos are kinda broken and old. I installed directly from yarn site and its solved.

ooops, sorry, I meant to ping @ewanjones . Yarn is installed and on my PATH (Yarn via Fedora 30 here).

chemzqm commented 5 years ago

You're best choice is moved away from Vundle, which is not maintained for years.

Paragon1970 commented 5 years ago

Experienced similiar error in nvim which I suspect was due to the pluging installing before yarn was installed (employing auto plug install script in init.vim):

Fix Executing within nvim:

:call coc#util#install()
[coc.nvim] Update completed
:checkhealth
health#coc#check
========================================================================
  - OK: Environment check passed

  - OK: Javascript bundle found
  - OK: Service started
kenden commented 5 years ago

It's not an issue with Vundle. I removed it, and installed vim-plug, and got the same issue. With Vundle or vim-plug, this command solved it (edit: from comment above)

:call coc#util#install()

Using a mac

Paragon1970 commented 5 years ago

@kenden Many thanks for confirming my previous post :-)

vdcow commented 5 years ago

Have the same issue with dein.

shivam-tripathi commented 4 years ago

I solved it with cd .vim/bundle/coc.nvim && yarn install

chrisbjohannsen commented 4 years ago

Was having the same issue when installed via minpac in vim8.

Solved by `cd ~/.vim/pack/minpack/start/coc.nvim && install.sh

oblitum commented 4 years ago

It's not an issue with Vundle. I removed it, and installed vim-plug, and got the same issue.

This is wrong. It must be an issue with Vundle that didn't support checking out branches. VIM-PLUG always supported this feature without issues. If it started working after you compile sources, it's because you're all checking out the master branch. The release branch just exists to provide JS compiled artifacts so you don't need to compile it yourself, also it removes the necessity of having yarn or npm for that.

I think the project could change the default checkout branch to the release one on Github. And update README removing release branch checkout, which would become the default, so it would avoid this confusion for people that don't know how to deal with plugin managers and git branches. In the case someone is interested in contributing or compiling from sources then this would require checking out the now non default master branch for development.

tonicebrian commented 4 years ago

I'm experiencing that exact same problem with dein. None of the previous solutions fixes the javascript file not found... log error.

matthiasdebernardini commented 4 years ago

I can say that Vundle is not compatible with this plugin.

I deleted my .vim folder, removed the rtp line in my .vimrc and changed the start and end line for the plugin list and for removed in from every line that had plugin. I then reopened vim and did :PlugInstall and CoC successfully for loaded in.

Maybe the readme can say that its not compatible with Vundle, but to be honest it doesn't look like its actively maintained any longer.

hyh1750522171 commented 4 years ago

install shell

#!/usr/bin/env bash

set -o nounset    # error when referencing undefined variable
set -o errexit    # exit when command fails

# Install latest nodejs
if [ ! -x "$(command -v node)" ]; then
    curl --fail -LSs https://install-node.now.sh/latest | sh
    export PATH="/usr/local/bin/:$PATH"
    # Or use apt-get
    # sudo apt-get install nodejs
fi

# Use package feature to install coc.nvim

# for vim8
mkdir -p ~/.vim/pack/coc/start
cd ~/.vim/pack/coc/start
curl --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz | tar xzfv -
# for neovim
# mkdir -p ~/.local/share/nvim/site/pack/coc/start
# cd ~/.local/share/nvim/site/pack/coc/start
# curl --fail -L https://github.com/neoclide/coc.nvim/archive/release.tar.gz | tar xzfv -

# Install extensions
mkdir -p ~/.config/coc/extensions
cd ~/.config/coc/extensions
if [ ! -f package.json ]
then
  echo '{"dependencies":{}}'> package.json
fi
# Change extension names to the extensions you need
npm install coc-snippets --global-style --ignore-scripts --no-bin-links --no-package-lock --only=prod
chemzqm commented 4 years ago

install scripts are removed and coc#util#install() won't work anymore, because it's likely to be broken, use release branch is recommended.

prashant0085 commented 4 years ago

navigating to ~/.vim/bundle/coc.nvim directory and ran yarn install and it worked.

Below is the output

image

I was assuming the node was already installed in the system as node --version used to give me output but when I tried to install yarn using brew, it first downloaded node and then installed yarn along with it.

chemzqm commented 4 years ago

Yarn doesn't comes with node.

Paragon1970 commented 4 years ago

As already mentioned Yarn is not included with node install. However, as an example, installing 'yarn' with with 'brew' will also include 'node' along with 'icu4c' since these are dependancies.

$ brew info yarn

dependencies for yarn: icu4c and node

nonameneeded commented 4 years ago

Fixed this with npm install -g coc.nvim.

loscarepapa commented 4 years ago

I fix with npm i es-abstract in cd ~/.vim/bundle/coc.nvim and use Vundle

CobraCoral commented 4 years ago

I was struggling with this since June this year. I finally got it to work... Here is what I did:

  1. This will show you your current config yarn config list

  2. I then set my registry to use the "HTTP" (NOTE: NOT the HTTPS!!!) yarn config set registry "http://registry.npmjs.org"

  3. For good measure, I did the same for npm: npm config set registry "http://registry.npmjs.org"

  4. I changed my .vimrc to do as follows: Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile --network-timeout 1000000'}

  5. You you can also cd to: ${HOME}/.local/share/nvim/plugins/coc.nvim (if you are on VIM, then go to ~/.vim and search for coc.nvim to see where it is installed with "cd ~/.vim && find . -name coc.nvim -type d"). Then run: yarn install --frozen-lockfile --network-timeout 1000000

This finally worked for me.... And I kinda know what the issue is. I noticed that my machine sends a RST (same isse these folks see here: https://github.com/yarnpkg/yarn/issues/5259) which just makes it not work. By switching to HTTP somehow I am bypassing whatever issues are there on this machine/network.

kalopseeia commented 4 years ago

Try to reinstalling your yarn ,.

sudo apt remove cmdtest sudo apt remove yarn curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update
sudo apt-get install yarn

then install coc.nvim again

kenden commented 4 years ago

I use VimPlug.
I just fixed this issue by replacing Plug 'neoclide/coc.nvim' by
Plug 'neoclide/coc.nvim', {'branch': 'release'}
in ~/.vimrc
And then opening vim and running :PlugUpdate.

as recommend by the README.md.

Note: that this is not what is indicated in https://vimawesome.com/plugin/coc-nvim

netops2devops commented 3 years ago

solved this on my macOS with the following :

cd .vim/bundle/coc.nvim && HOMEBREW_NO_AUTO_UPDATE=1 brew install yarn && yarn install

pynvimdev commented 3 years ago

JUST DO THIS just do yarn install after navigating to the specific location EXAMPLE cd mypluggeddirectory cd coc.nvim yarn install

octosteve commented 2 years ago

JUST DO THIS just do yarn install after navigating to the specific location EXAMPLE cd mypluggeddirectory cd coc.nvim yarn install

yarn install didn't work for me. Running :call coc#util#install() did however.