bchatard / alfred-jetbrains

Alfred5 workflow to easily open your projects with your favorite JetBrains product.
MIT License
621 stars 49 forks source link

Workflow won't show when use Volta manage Node version #276

Closed BrianCodeItUp closed 2 years ago

BrianCodeItUp commented 2 years ago

FAQ

Describe the bug

I use volta to manage node version. Workflow doesn't show after install this package as global denpendencies.

To Reproduce

  1. Install node through volta, it should install the lastest lts version of node
    volta install node
  2. Install @bchatard/alfred-jetbrains as global dependency
    yarn global add  @bchatard/alfred-jetbrains 

Expected behavior

Workflow should show after install @bchatard/alfred-jetbrains as global dependency

Alfred Version

4.6.3

Node Version

16.5.1

NPM Version

8.11.0

Jetbrains Product & Version

WebStrom 2022.1.2

Installation type

Classic via .dmg

OS

macOS 12.3.1

bchatard commented 2 years ago

hi,

can you try with npm? and also provide the installation trace?

BrianCodeItUp commented 2 years ago

Here is the installation trace

image

I suspect that this issue has something to do with how volta handles global dependencies. I'll look into it later.

bchatard commented 2 years ago

ok, I double check my env & how I install the workflow for the first time & how I update it.

So I have node installed globally with brew, I use it to install / update the workflow (actually node 18.3 / npm 8.12.1). Then workflow used the version pined in his package.json

If I understand the doc of Volta, you should run volta install @bchatard/alfred-jetbrains (source: https://blog.volta.sh/2019/06/18/global-installs-done-right/). Before remove completely version install with npm

BrianCodeItUp commented 2 years ago

I tried to use volta install @bchatard/alfred-jetbrains to install it as global dependency but the result is the same. Then i remove Volta completely and reinstall node with Homebrew. Then it works.

Then i reinstall Volta again and it still works. I'll look into it later. But we now know the solution is remove volta and install node using other means.

ahoendgen commented 2 years ago

I had the same issue and thought these infos could be helpful for others.

I found out that the symlink in the workflows folder is wrong. Volta puts packages in a temp folder which messes things up.

grafik

if you run npm -g list you will see that the packages are installed to e.g. /Users/andre/.volta/tools/image/node/16.14.0/lib and not into the tmp folder (see screenshot).

Volta seems to have a bug with global installs without a bin in the package.

I solved it this way:

I installed node via homebrew but didn't link it so i could keep my volta installation as is.

Then i used the installed npm binary to install the extension e.g. /opt/homebrew/Cellar/node/18.6.0/libexec/bin/npm install -g @bchatard/alfred-jetbrains.

Now the workflow should be listed when you run npm -g list. Anyway it's not installed in alfred, you still have to go to your Alfred.alfredpreferences/workflows folder and symlink the workflow manually e.g. ln -s /Users/YOUR_USER/.volta/tools/image/node/16.14.0/lib/node_modules/@bchatard/alfred-jetbrains /YOUR/PATH/TO/alfred/Alfred.alfredpreferences/workflows/@bchatard-alfred-jetbrains

it took 10 seconds for alfred to recognize the "new" workflow, afterwards it works fine again.