-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Cannot exec or spawn node, npm or yarn [node snap] #37982
Comments
I mentioned this issue in the snap forum, so we might receive some special assistance from snap experts: https://forum.snapcraft.io/t/node-snap-issues-with-exec-of-npm-node-yarn/23635 |
Can you try to run the following commands in your terminal: /bin/sh -c 'node -v'
/bin/sh -c 'npm --version'
/bin/sh -c 'yarn --version' |
Sure, here you are:
|
microsoft/vscode-vsce#341 was recently closed, apparently owing to this or a similar problem with child processes. Mentioning here. |
Hi! We installed Node.js via snap store and tried to use |
I am getting same error when doing I tried doing When I run the script directly (instead of via yarn), it returns the node inside the nvm directory path, but still not working. Interestingly |
I looked into this. EDIT: node cannot run on the other hand, running node in the true path (in my case /snap/node/6694/bin/node currently) will work. otherwise the command ================== Edit End =========
but this means, whenever a |
@Bloodiko great work looking into this! 😊 |
In the meanwhile the following workaround should help (works on Ubuntu 22.04): for cmd in node npm yarn; do
mkdir -p ~/bin
cat > "$HOME/bin/$cmd" << EOF
#!/bin/bash
# https://github.com/nodejs/node/issues/37982
/snap/bin/$cmd "\$@" > >(cat) 2> >(cat >&2)
EOF
chmod +x "$HOME/bin/$cmd"
done |
I'll go ahead and close this because it's a snap sandbox restriction, not an issue with node itself. If the restriction is a problem for you, you should report it to the maintainers of the snap package. |
v14.16.0
Linux fabio-XPS-15-7590 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
child_process
What steps will reproduce the bug?
Install node snap:
sudo snap install node --classic
Optional: fix permission issues https://npm.github.io/installation-setup-docs/installing/a-note-on-permissions.html
Then run the following:
How often does it reproduce? Is there a required condition?
It always happens to me. I think a requirement to be using node from the snap.
What is the expected behaviour?
What do you see instead?
The output of node and npm commands is empty, while yarn fails.
However, running each of those commands from the terminal works correctly:
Additional information
Running a command like
which npm
returns the correct binary path both from the terminal and from the script. I also attempted to write the full path in the script, instead of the command, (e.g./home/fabio/.npm-global/bin/npm
) but nothing changes.The node binary is provided by the node snap. However, I could not find clear issues in the logs. Also npm and yarn are provided in the snap, but I installed them globally under
/home/fabio/.npm-global
.✅ I'm willing to help with debugging and getting this solved. 👨💻
The text was updated successfully, but these errors were encountered: