Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/Users/user/Library/pnpm/pnpm: line 16: exec: node: not found #221787

Closed
andriustbol opened this issue Jul 16, 2024 · 4 comments
Closed

/Users/user/Library/pnpm/pnpm: line 16: exec: node: not found #221787

andriustbol opened this issue Jul 16, 2024 · 4 comments
Assignees
Labels
git GIT issues info-needed Issue requires more information from poster

Comments

@andriustbol
Copy link

andriustbol commented Jul 16, 2024

Type: Bug

Whenever trying to commit or switching between branches VSC throws this error.

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
/Users/user/Library/pnpm/pnpm: line 16: exec: node: not found
husky - pre-commit hook exited with code 127 (error)
husky - command not found in PATH=/Library/Developer/CommandLineTools/usr/libexec/git-core:/Users/user/Library/pnpm:/opt/local/bin:/opt/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/user/Library/Python/3.9/bin:/Users/user/opt/sonar-scanner-5.0.1.3006-macosx/bin

Already tried suggestions from these threads, but they did not help:

  1. Extension fails with pnpm command not found #148903
  2. node_modules/.bin/jest: line 16: exec: node: not found jest-community/vscode-jest#741
  3. env issues on MacOS jest-community/vscode-jest#526

VS Code version: Code 1.91.1 (Universal) (611f9bf, 2024-06-11T21:02:41.372Z)
OS version: Darwin arm64 23.4.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 2, 3, 3
Memory (System) 16.00GB (0.57GB free)
Process Argv --crash-reporter-id 273854ef-0074-4dcd-8e0d-8ba404e1a6d7
Screen Reader no
VM 0%
Extensions (20)
Extension Author (truncated) Version
vscode-tailwindcss bra 0.12.0
npm-intellisense chr 1.4.5
vscode-markdownlint Dav 0.55.0
vscode-eslint dba 3.0.10
vscode-axe-linter deq 4.9.0
vscode-html-css ecm 2.0.10
prettier-vscode esb 10.4.0
vscode-jest-runner fir 0.4.73
auto-rename-tag for 0.1.10
react-component-tree Hab 1.1.1
debugpy ms- 2024.6.0
isort ms- 2023.10.1
python ms- 2024.8.1
vscode-versionlens pfl 1.14.2
vs-code-prettier-eslint rve 6.0.0
html5-boilerplate sid 1.1.1
sapling tea 1.2.0
gitblame wad 11.0.1
pretty-ts-errors Yoa 0.5.4
markdown-all-in-one yzh 3.6.2
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonregdiag2:30936856
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
chatpanelc:31048052
dsvsc021:30996838
da93g388:31013173
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
impr_priority:31094925
refactort:31093865
pythonrstrctxtcf:31093870

@vscodenpa
Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.91.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@lszomoru
Copy link
Member

@andriustbol, it looks like your git repository has some git hooks defined that rely on pnpm being available on the path. Git will respect the environment variables that are available in the "environment" in which code.exe was started. How do you launch VS Code? Is pnpm on the path in the window where you start VS Code from?

@lszomoru lszomoru added git GIT issues info-needed Issue requires more information from poster labels Jul 16, 2024
@andriustbol
Copy link
Author

andriustbol commented Jul 16, 2024

How do you launch VS Code?

I launch it from the dock panel or `Machintosh HD > Applications > Visual Studio Code.app

Is pnpm on the path in the window where you start VS Code from?

Opening Terminal in VSC after launching it and typing pnpm results in: /Users/user/Library/pnpm/pnpm: line 16: exec: node: not found. However I am using NVM, so I need to do nvm use to set the defined versions, and then pnpm works fine in Terminal. Unfortunately this does not resolve the issue when switching between branches, or making commit, it throws this:

Screenshot 2024-07-16 at 14 56 14

"husky": "8.0.3"

.husky/post-checkout

bash
#!/usr/bin/env sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
. "$(dirname -- "$0")/_/husky.sh"

nvm use

But it works just fine if I open Terminal, navigate to my project dir, type nvm use, and then code ..

@lszomoru
Copy link
Member

But it works just fine if I open Terminal, navigate to my project dir, type nvm use, and then code ..

Thanks for trying this out, and confirming this. As mentioned, the git process that is spawned by VS Code for every source control operation inherits the "environment" from VS Code, which is the "environment" in which VS Code was launched. At the moment the only solution is to launch VS Code from an "environment" where everything is initialized that is necessary for the git hooks.

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
git GIT issues info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants