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

Not able to install without bash, and not able to uninstall with bash #620

Closed
AvailCat opened this issue Nov 11, 2019 · 4 comments · Fixed by #656
Closed

Not able to install without bash, and not able to uninstall with bash #620

AvailCat opened this issue Nov 11, 2019 · 4 comments · Fixed by #656
Assignees

Comments

@AvailCat
Copy link

AvailCat commented Nov 11, 2019

It looks like there is no way to run sentry-cli in a clean way, not install, or installed but not able to uninstall.

System: Ubuntu 18.04.3 LTS
Node: 12.10.0

To reproduce this, start a clean environment with docker and run commands below to test.

docker run --rm -it node:lts /bin/bash

or

docker run --rm it node:lts-buster /bin/bash

Problem 1:
Install with npm, root don't have permission to /root?

root@8b8fe383db83:~# npm i -g @sentry/cli
/usr/bin/sentry-cli -> /usr/lib/node_modules/@sentry/cli/bin/sentry-cli

> @sentry/cli@1.49.0 install /usr/lib/node_modules/@sentry/cli
> node scripts/install.js

Error: EACCES: permission denied, mkdir '/root/.npm/sentry-cli'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @sentry/cli@1.49.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @sentry/cli@1.49.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-11-11T06_42_00_118Z-debug.log
root@8b8fe383db83:~# 

Problem 2:
Run with npx

root@8b8fe383db83:~# npx @sentry/cli sentry-cli
internal/modules/cjs/loader.js:775
    throw err;
    ^

Error: Cannot find module '/root/.npm/_npx/10940/lib/node_modules/@sentry/cli/scripts/install.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:999:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @sentry/cli@1.49.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @sentry/cli@1.49.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-11-11T06_44_07_173Z-debug.log
Install for [ '@sentry/cli@latest' ] failed with code 1
root@8b8fe383db83:~# 

Problem 3:
Uninstall sentry which installed with bash script

root@8b8fe383db83:~# sentry-cli uninstall
  INFO    2019-11-11 06:52:49.363803311 +00:00 Loaded config from /root/.sentryclirc
  DEBUG   2019-11-11 06:52:49.363829051 +00:00 sentry-cli version: 1.49.0, platform: "linux", architecture: "x86_64"
  INFO    2019-11-11 06:52:49.363839390 +00:00 sentry-cli was invoked with the following command line: "sentry-cli" "uninstall"
Do you really want to uninstall sentry-cli? [y/n] y
Need to sudo to uninstall /usr/local/bin/sentry-cli
  DEBUG   2019-11-11 06:52:51.827868498 +00:00 error: running update nagger
  INFO    2019-11-11 06:52:51.827986347 +00:00 Skipping update nagger update check
error: No such file or directory (os error 2)
  DEBUG   2019-11-11 06:52:51.828440711 +00:00 client close; no transport to shut down  (from sentry)
root@8b8fe383db83:~# 

# Loop, never uninstall
@tonyo
Copy link
Contributor

tonyo commented Nov 12, 2019

Problem 1:

Looks like npm doesn't allow to install globally for root by default, but it can be changed if you do

npm config set unsafe-perm true

There's some additional information in this comment/thread: nvm-sh/nvm#1407 (comment)

Problem 2:

Hm, is it the full log, or there's something else in /root/.npm/_logs/2019-11-11T06_44_07_173Z-debug.log? I don't think we've ever tested sentry-cli with npx yet, though.

Problem 3:

Can confirm, it doesn't work as expected. We'll have a look.

Thanks for the report!

@tonyo tonyo self-assigned this Nov 12, 2019
@tonyo
Copy link
Contributor

tonyo commented Nov 12, 2019

It looks like npm config set unsafe-perm true also fixes Problem 2.

@AvailCat
Copy link
Author

@tonyo Confirm work.

@kamilogorek
Copy link
Contributor

Problem 1: Solved above
Problem 2: It works fine now. You don't need to specify the name of a binary, just a package, so npx @sentry/cli <commands>
Problem 3: #652

KeymakerDI added a commit to KeymakerDI/builder-appcenter that referenced this issue Oct 13, 2020
Have to also set "unsafe-perm true", see getsentry/sentry-cli#620
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants