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

Cannot install node.js binaries on Ubuntu #2771

Closed
medikoo opened this issue Mar 22, 2022 · 6 comments
Closed

Cannot install node.js binaries on Ubuntu #2771

medikoo opened this issue Mar 22, 2022 · 6 comments
Labels
needs followup We need some info or action from whoever filed this issue/PR.

Comments

@medikoo
Copy link

medikoo commented Mar 22, 2022

I'm working with fresh Ubuntu installation and it appears that nvm doesn't work (cannot install any Node.js version due to "Permission denied" errors)

Operating system and version:

Ubuntu 20.04.2

nvm debug output:

nvm --version: v0.39.1
$SHELL: /bin/bash
$SHLVL: 1
whoami: 'parallels'
${HOME}: /home/parallels
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)'
uname -a: 'Linux 5.13.0-37-generic #42~20.04.1-Ubuntu SMP Tue Mar 15 15:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Ubuntu 20.04.4 LTS  
curl: /snap/bin/curl, curl 7.82.0 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 zstd/1.4.4 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3 libgsasl/1.8.1 OpenLDAP/2.4.49
wget: /usr/bin/wget, GNU Wget 1.20.3 built on linux-gnu.
git: /usr/bin/git, git version 2.25.1
grep: /usr/bin/grep (grep --color=auto), grep (GNU grep) 3.4
awk: /usr/bin/awk, awk: not an option: --version
sed: /usr/bin/sed, sed (GNU sed) 4.7
cut: /usr/bin/cut, cut (GNU coreutils) 8.30
basename: /usr/bin/basename, basename (GNU coreutils) 8.30
rm: /usr/bin/rm, rm (GNU coreutils) 8.30
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.30
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0
nvm current: system
which node: /snap/bin/node
which iojs: 
which npm: /usr/local/bin/npm
npm config get prefix: /usr/local
npm root -g: /usr/local/lib/node_modules

nvm ls output:

->       system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
lts/* -> lts/gallium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.11 (-> N/A)
lts/fermium -> v14.19.1 (-> N/A)
lts/gallium -> v16.14.2 (-> N/A)

How did you install nvm?

curl install script in readme

What steps did you perform?

nvm install v16

What happened?

$ nvm install v16
Downloading and installing node v16.14.2...
Downloading https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.xz...
Warning: Failed to create the file 
Warning: /home/parallels/.nvm/.cache/bin/node-v16.14.2-linux-x64/node-v16.14.2-
Warning: linux-x64.tar.xz: Permission denied
                                                                                                                                                         0.0%curl: (23) Failure writing output to destination

Binary download from https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.xz failed, trying source.
grep: /home/parallels/.nvm/.cache/bin/node-v16.14.2-linux-x64/node-v16.14.2-linux-x64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Downloading https://nodejs.org/dist/v16.14.2/node-v16.14.2.tar.xz...
Warning: Failed to create the file 
Warning: /home/parallels/.nvm/.cache/src/node-v16.14.2/node-v16.14.2.tar.xz: 
Warning: Permission denied
curl: (23) Failure writing output to destination

Binary download from https://nodejs.org/dist/v16.14.2/node-v16.14.2.tar.xz failed, trying source.
grep: /home/parallels/.nvm/.cache/src/node-v16.14.2/node-v16.14.2.tar.xz: No such file or directory
Provided file to checksum does not exist.

What did you expect to happen?

I expected it being installed without issues

Is there anything in any of your profile files that modifies the PATH?

nvm added itself to the path, and that works correctly

@ljharb
Copy link
Member

ljharb commented Mar 22, 2022

Assuming whoami is parallels, then that user should fully own everything inside of $HOME. Can you check the permissions on that directory?

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Mar 22, 2022
@medikoo
Copy link
Author

medikoo commented Mar 22, 2022

Yes, all looks good there (same it's just parallels:parallels in context of nvm)

parallels@parallels-Parallels-Virtual-Platform:~$ ls -la 
total 128
drwxr-xr-x 24 parallels parallels 4096 Mar 22 17:46 .
drwxr-xr-x  3 root      root      4096 Aug  7  2020 ..
-rw-------  1 parallels parallels 4590 Mar 22 18:09 .bash_history
-rw-r--r--  1 parallels parallels  220 Aug  7  2020 .bash_logout
-rw-r--r--  1 parallels parallels 3968 Mar 22 17:31 .bashrc
drwx------ 13 parallels parallels 4096 Mar 22 16:08 .cache
drwxr-xr-x 12 parallels parallels 4096 Mar 22 15:54 .config
drwxr-xr-x  2 parallels parallels 4096 Mar 22 14:45 Desktop
drwxr-xr-x  2 parallels parallels 4096 Aug  7  2020 Documents
drwxr-xr-x  2 parallels parallels 4096 Aug  7  2020 Downloads
drwxr-xr-x  2 parallels parallels 4096 Mar 22 15:54 fontconfig
-rw-rw-r--  1 parallels parallels   56 Mar 22 16:00 .gitconfig
drwx------  3 parallels parallels 4096 Mar 22 16:13 .gnupg
drwx------  3 parallels parallels 4096 Aug  7  2020 .local
drwx------  4 parallels parallels 4096 Mar 22 16:08 .mozilla
drwxr-xr-x  2 parallels parallels 4096 Aug  7  2020 Music
drwxrwxr-x  5 parallels parallels 4096 Mar 22 16:56 .npm
drwxrwxr-x  6 parallels parallels 4096 Mar 22 17:07 .npm-cross-link
drwxrwxr-x  3 parallels parallels 4096 Mar 22 16:11 npm-packages
drwxrwxr-x  7 parallels parallels 4096 Mar 22 17:46 .nvm
drwxr-xr-x  2 parallels parallels 4096 Mar 22 14:47 .parallels
drwxr-xr-x  2 parallels parallels 4096 Aug  7  2020 Pictures
-rw-r--r--  1 parallels parallels  807 Aug  7  2020 .profile
drwxr-xr-x  2 parallels parallels 4096 Aug  7  2020 Public
drwx------  5 parallels parallels 4096 Mar 22 17:31 snap
drwx------  2 parallels parallels 4096 Mar 22 16:08 .ssh
-rw-r--r--  1 parallels parallels    0 Aug  7  2020 .sudo_as_admin_successful
drwxr-xr-x  2 parallels parallels 4096 Aug  7  2020 Templates
drwxr-xr-x  2 parallels parallels 4096 Aug  7  2020 Videos
-rw-------  1 parallels parallels 2285 Mar 22 16:10 .viminfo
drwxrwxr-x  5 parallels parallels 4096 Mar 22 16:17 .vscode-server
-rw-rw-r--  1 parallels parallels  183 Mar 22 16:17 .wget-hsts

I can share this Ubuntu image if needed (runable in Parallels Desktop on Mac)

@ljharb
Copy link
Member

ljharb commented Mar 22, 2022

Sure, i can give that a try!

@medikoo
Copy link
Author

medikoo commented Mar 22, 2022

I've looked more closely, and it appears that the issue happens when curl is installed via Ubuntu's snap dependency management. It seems that software installed that way, is way more restricted, and many different issues happen. e.g. Node.js, as installed via snap, is totally unusable -> nodejs/node#42438

When I've installed curl via apt instead of snap, nvm installs Node.js versions without issues

@ljharb great thanks for prompt reaction, feel free to close (unless you think some better error messaging may help in such case)

@ljharb
Copy link
Member

ljharb commented Mar 22, 2022

Always happy to review a PR that improves error messaging, but since node should never be installed via unofficial means (which includes apt/snap, and doesn't include version managers like nvm that just automate the official install process for you), and since it hasn't been frequently reported, i'll close.

Glad you figured it out!

@Lokesh01
Copy link

Lokesh01 commented Aug 1, 2023

I've looked more closely, and it appears that the issue happens when curl is installed via Ubuntu's snap dependency management. It seems that software installed that way, is way more restricted, and many different issues happen. e.g. Node.js, as installed via snap, is totally unusable -> nodejs/node#42438

When I've installed curl via apt instead of snap, nvm installs Node.js versions without issues

@ljharb great thanks for prompt reaction, feel free to close (unless you think some better error messaging may help in such case)

thanks man this really helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR.
Projects
None yet
Development

No branches or pull requests

3 participants