gtop icon indicating copy to clipboard operation
gtop copied to clipboard

Cannot Install via NPM

Open InklingGirl opened this issue 2 years ago • 4 comments

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

It fails to install.

InklingGirl avatar Feb 25 '22 17:02 InklingGirl

+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)

`

teknetik avatar Mar 28 '22 18:03 teknetik

@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 avatar Mar 29 '22 18:03 InklingGirl

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 avatar Jul 16 '22 20:07 InklingGirl

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.

InklingGirl avatar Sep 20 '22 04:09 InklingGirl