bchatard / alfred-jetbrains

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

Error: ENOENT: no such file or directory on Intellj IDEA 2020.3 #187

Closed brewagebear closed 3 years ago

brewagebear commented 3 years ago
Q A
Workflow version 1.4.4
OSX Version 10.15.7
Alfred Version 4.3
JetBrains Product/Version Intellj IDEA / 2020.3
Installation type JB Toolbox
Node version 15.4.0 (node --version)
NPM version 7.0.15 (npm --version)

Description

Screen Shot 2020-12-22 at 6 41 24 PM

I don't know for some reason, but the problem seems to be that the script points to a strange path (like ../Application Support/Google).

Error log

Error: ENOENT: no such file or directory, scandir '/Users/seansin/Library/Application Support/Google'
    at Proxy.readdirSync (node:fs:1044:3)
    at getDirectories (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/src/product.js:10:6)
    at getPreferencePath (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/src/product.js:75:19)
    at Object.get (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/src/product.js:157:30)
    at /usr/local/lib/node_modules/@bchatard/alfred-jetbrains/src/index.js:13:38
    at Object.<anonymous> (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/src/index.js:60:3)
    at Object.<anonymous> (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/esm/esm.js:1:251206)
    at /usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/esm/esm.js:1:245054
    at Generator.next (<anonymous>)
    at bl (/usr/local/lib/node_modules/@bchatard/alfred-jetbrains/node_modules/esm/esm.js:1:245412)

The workflow reinstallation was carried out first.

$ rm -rf /usr/local/lib/node_modules/@bchatard
$ npm uninstall -g @bchatard/alfred-jetbrains
$ npm install -g @bchatard/alfred-jetbrains

After that, we rechecked the generated idea shell script.

Screen Shot 2020-12-22 at 6 43 18 PM

cat $(which idea) result

#!/bin/sh
#Generated by JetBrains Toolbox 1.19.7784 at 2020-12-22T18:29:04.610887

declare -a ideargs=()
declare -- wait=""

for o in "$@"; do
  if [[ "$o" = "--wait" || "$o" = "-w" ]]; then
    wait="-W"
    o="--wait"
  fi
  if [[ "$o" =~ " " ]]; then
    ideargs+=("\"$o\"")
  else
    ideargs+=("$o")
  fi
done

open -na "/Users/seansin/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/203.5981.155/IntelliJ IDEA.app/Contents/MacOS/idea" $wait --args "${ideargs[@]}"%

How can we resolve this issue?

bchatard commented 3 years ago

please check 1.5.0

brewagebear commented 3 years ago

@bchatard Updating to version 1.5.0 did not solve the above error.

Version 1.4.4 has been deleted as described above.

$ rm -rf /usr/local/lib/node_modules/@bchatard
$ npm uninstall -g @bchatard/alfred-jetbrains
$ npm install -g @bchatard/alfred-jetbrains

and remove workflow in alfred However, as I already said, the same error is occurring. The above issue specification has been omitted, and the version of 'Tool Box' is using version 1.19. The 1.5.0 version is probably a patch that responds to this 'Tool Box' version, but it keeps getting the same error.

What's the problem?

mathieutu commented 3 years ago

Getting the same error when fresh installing today.

bchatard commented 3 years ago

@dailyworker & @mathieutu ok I understand the issue. For some weird reason the check of directory existence throw an exception when searching for the "product information". A quick workaround is to alter src/product.js, to change the order of the directory list (~ line 61):

- `${process.env.HOME}/Library/Application Support/Google`, // >= Android Studio 4.1
- `${process.env.HOME}/Library/Application Support/JetBrains`, // >= 2020.*
+ `${process.env.HOME}/Library/Application Support/JetBrains`, // >= 2020.*
+ `${process.env.HOME}/Library/Application Support/Google`, // >= Android Studio 4.1

I will work to a proper fix as soon as I can