wix/import-cost

[coc.nvim]: UnhandledRejection: Cannot find module 'tslib'

dquevid opened this issue · 7 comments

I get this message when opening a .js file in NeoVim. I tried to install tslib in the extension directory, but another error occurred.

[coc.nvim]: UnhandledRejection: Cannot find module 'tslib'
Require stack:

  • /home/dqvid/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
  • /home/dqvid/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
    Error: Cannot find module 'tslib'
    Require stack:
  • /home/dqvid/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
  • /home/dqvid/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at e (/home/dqvid/.local/share/nvim/plugged/coc.nvim/build/index.js:250:18040)
    at Object. (/home/dqvid/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js:3:17)
    at Module._compile (/home/dqvid/.local/share/nvim/plugged/coc.nvim/build/index.js:250:18366)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Module.require (node:internal/modules/cjs/loader:1105:19)

same with vscode, no consequence client side (just slow, and make github copilot crash), but vscode-server on linux machine keep crashing

I haven't been able to figure this out either. I'm using:

nodejs v19.3.0

Tried installing tslib manually but now get a weird SSL error.

I am able to reproduce this. Running off of a fresh coc + coc-import-cost combo I receive:

[coc.nvim]: UnhandledRejection: Cannot find module 'tslib'
Require stack:
- $HOME/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
- $HOME/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
Error: Cannot find module 'tslib'
- $HOME/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
- $HOME/.config/coc/extensions/node_modules/coc-import-cost/lib/extension.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    ...

I am running off of Fedora 37 with node v18.14.2.

Not sure if it will solve the issue for people above, but I noticed that by going into $HOME/.config/coc/extensions/node_modules/coc-import-cost and running npm install fixed the missing dependency issue.

(Found this issue, because the bundle size calculation is not showing up for me at all and the above issue is one that I managed to solve...)

FYI, https://github.com/barrett-ruth/import-cost.nvim is also built on wix/import-cost and I have had success with it

Thanks for the recommendation! Looks like it's a neovim plugin, so I'd have to first get on neovim. Maybe this will be a good opportunity to give it a go!

Not sure if it will solve the issue for people above, but I noticed that by going into $HOME/.config/coc/extensions/node_modules/coc-import-cost and running npm install fixed the missing dependency issue.

(Found this issue, because the bundle size calculation is not showing up for me at all and the above issue is one that I managed to solve...)

I have same issue