BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.62k stars 212 forks source link

Unable to start shadow-cljs project #591

Closed Looveh closed 4 years ago

Looveh commented 4 years ago

Issue Type: Bug

Try starting a shadow-cljs project with:

C-M-c C-M-j > shadow-cljs > :app

Getting the error:

> Executing task: npx shadow-cljs -d cider/piggieback:0.4.2 -d cider/cider-nrepl:0.23.0 watch :app <

/bin/bash: npx: command not found
The terminal process terminated with exit code: 127

Terminal will be reused by tasks, press any key to close it.

Project config:

; shadow-cljs.edn
{:deps
 {:aliases [:dev]}

 :builds
 {:app
  {:target           :react-native
   :init-fn          my.app/init
   :output-dir       "out"
   :compiler-options {:infer-externs :auto}
   :devtools         {:autoload true}}}}

; deps.edn:
{:paths
 ["src/"]

 :deps
 {reagent              {:mvn/version "0.9.0-rc3"}
  re-frame             {:mvn/version "0.11.0-rc3"}
  thheller/shadow-cljs {:mvn/version "2.8.81"}}

 :aliases
 {:dev {:extra-paths ["src/"]}}}

Extension version: 2.0.85 VS Code version: Code 1.43.0 (78a4c91400152c0f27ba4d363eb56d2835f9903a, 2020-03-09T19:34:44.548Z) OS version: Darwin x64 19.3.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|2, 2, 2| |Memory (System)|16.00GB (0.10GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
hindol commented 4 years ago

If you open a terminal in VSCode, can you run npx? If it is not found, then that's your problem.

PEZ commented 4 years ago

@Looveh If you do which npx in a terminal outside of vsocde, and examine thePATH variable in a vscode integrated shell, does it contain the path?

Looveh commented 4 years ago

When I open VSCode as you'd open any other application on Mac, npx isn't found on the path. If I open it using code in bash, it's there as expected.

hindol commented 4 years ago

@Looveh That is because if you open VSCode from bash, all environment variables (including $PATH) are retained. You can try changing the default shell in VSCode to bash.

PEZ commented 4 years ago

This looks a bit relevant: https://github.com/microsoft/vscode/issues/30847#issuecomment-420399383

Not sure what Calva can do about it, except instructions on how to fix it (or work around it, if that is the best we can do).

PEZ commented 4 years ago

Also, @Looveh . Is lein's location on your $PATH in the integrated terminal, but not npx?

hindol commented 4 years ago

@PEZ Regarding the linked comment, in MacOS one can update /etc/paths or /etc/paths.d/\<some-file> so that both the OS and terminals have access to it. This way, inconsistencies can be avoided.

If someone uses other ways to update $PATH, for example via .profile, .bash_profile, .bashrc (assuming bash), then VSCode launched using the app icon will not have access to this additions.

StackExchange: https://unix.stackexchange.com/questions/356688/what-is-the-difference-between-echo-path-and-etc-paths/356720

PEZ commented 4 years ago

🙏

I've been using OSX since it was in its first beta, but haven't stumbled across this problem before. 😄

PEZ commented 4 years ago

I added some info about this to the docs: https://calva.readthedocs.io/en/dev/quirks.html#command-not-found-errors-on-jack-in

bpringe commented 4 years ago

Updating the link to where this is documented, since I was just updating docs and followed the link to this issue: https://calva.io/quirks/#command-not-found-errors-on-jack-in