neoclide / coc.nvim

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

Error when installing on termux (Android) #4933

Closed luisdavim closed 4 months ago

luisdavim commented 4 months ago

I'm getting an error when trying tto install coc on Android.

Reproduce the bug

Running npm ci results in the following error:

$ npm ci
[##################] - reify:typescript: timing reifyNode:node_modules/caniuse-lite Completed in 3409ms
> @swc/core@1.4.2 postinstall
> node postinstall.js

Error: Cannot find module '@swc/core-android-arm64'fyNode:node_modules/caniuse-lite Completed in 3409ms
Require stack:
- /data/data/com.termux/files/home/.vim/bundle/coc.nvim/node_modules/@swc/core/binding.js
- /data/data/com.termux/files/home/.vim/bundle/coc.nvim/node_modules/@swc/core/postinstall.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1149:15)
    at Module._load (node:internal/modules/cjs/loader:990:27)
    at Module.require (node:internal/modules/cjs/loader:1237:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/data/data/com.termux/files/home/.vim/bundle/coc.nvim/node_modules/@swc/core/binding.js:67:41)
    at Module._compile (node:internal/modules/cjs/loader:1378:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
    at Module.load (node:internal/modules/cjs/loader:1212:32)
    at Module._load (node:internal/modules/cjs/loader:1028:12)
    at Module.require (node:internal/modules/cjs/loader:1237:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/data/data/com.termux/files/home/.vim/bundle/coc.nvim/node_modules/@swc/core/binding.js',
    '/data/data/com.termux/files/home/.vim/bundle/coc.nvim/node_modules/@swc/core/postinstall.js'
  ]
}
@swc/core was not able to resolve native bindings installation. It'll try to use @swc/wasm as fallback instead.
[##################] \ reify:typescript: timing reifyNode:node_modules/caniuse-lite Completed in 3409ms
> esbuild@0.17.19 postinstall
> node install.js

> coc.nvim-master@0.0.82 prepare
> node esbuild.js

added 559 packages, and audited 560 packages in 11s

83 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

I can get around it with:

$ npm i @swc/core-android-arm64

added 1 package, changed 1 package, and audited 562 packages in 4s

83 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

But I have to do that from the coc folder installing the package globaly is not enough.

fannheyward commented 4 months ago

I didn't test with Termux, from the logs, swc couldn't install native binary but fallback to wasm one, the installation was completed to run npm run build, coc.nvim's building is successful.

I think this is caused with wrong version matching: coc.nvim wants to install @swc/core@1.4.2, but the @swc/core-android-arm64 is 1.3.11, https://www.npmjs.com/package/@swc/core-android-arm64.