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 via NPM #126

Open
InklingGirl opened this issue Feb 25, 2022 · 4 comments
Open

Cannot Install via NPM #126

InklingGirl opened this issue Feb 25, 2022 · 4 comments

Comments

@InklingGirl
Copy link

  • OS: Canonical's Ubuntu 20.04 LTS Focal Fossa
  • Node version: v10.19.0
  • gtop version: 1.1.3

It fails to install.

@teknetik
Copy link

+1

`Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal

nodejs --version
v10.19.0

Error:

/usr/local/lib/node_modules/gtop/node_modules/marked-terminal/index.cjs:333
&& Number(osRelease[2]) >= 10_586
^^

SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/usr/local/lib/node_modules/gtop/node_modules/blessed-contrib/lib/widget/markdown.js:5:24)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

`

@InklingGirl
Copy link
Author

@teknetik I've been able to find a solution on my own, I guess.

Add the official Node.js repo:
curl -sL https://deb.nodesource.com/setup_17.x | sudo -E bash -

Followed by installing the nodejs meta-package (not npm) :
sudo apt install nodejs

Followed by installing gtop w/ superuser permissions specifically:
sudo npm install gtop -g

After that, gtop seems to work. If a developer/maintainer has any better advice or insight to contribute, we're still waiting to hear it; get around to your users' tickets!

@InklingGirl
Copy link
Author

Add the official Node.js repo:
curl -sL https://deb.nodesource.com/setup_17.x | sudo -E bash -

On Ubuntu 22.04, now:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

@InklingGirl
Copy link
Author

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -

Alternatively, you could more manually set up the repo w/o curling that shell script, like this:

wget -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/nodesource.gpg

echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main
deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main' | sudo tee /etc/apt/sources.list.d/nodesource.list

Also, I recently found out you can install gtop & other Node.js packages w/ yarn, which is a faster package manager for them:

wget -O- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/nodesource.gpg

echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main
deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x jammy main' | sudo tee /etc/apt/sources.list.d/nodesource.list

wget -O- https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg

echo 'deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main' | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update

sudo apt install yarn

sudo yarn global add gtop

^ This is how I do it now. As shown, in addition to the Yarn repo you still need to add the Node.js repo, that's to get the latest nodejs package (for gtop to work at all), which will–unless you've messed w/ apt's defaults–be installed automatically alongside yarn as a recommended package.

Again, the maintainer should really update his project's README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants