question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

>4.3 no longer installs correctly with `npm install -g` (sqlite3)

See original GitHub issue
  • Node version: 16.14
  • Operating system: Ubuntu 20.04 LTS
  • The Lounge version: git 7cf95d3cbde8cf41957df93c8d4a3547bebd4cae

To reproduce this take an Ubuntu 20.04 system and perform the following:

wget 'https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz'
tar -xvf node-v16.14.0-linux-x64.tar.xz --strip-components=1 -C /usr/local
git clone https://github.com/thelounge/thelounge.git
cd thelounge
# (build steps are missing here, these don't matter for the demonstration)
npm pack .
cd ..
npm install -g --prefix $PWD/test ./thelounge/thelounge-4.3.0.tgz

Expected behaviour: The sqlite module is installed at test/lib/node_modules/thelounge/node_modules/sqlite3.

Actual behaviour: There is a broken symlink at test/lib/node_modules/sqlite3. lrwxrwxrwx 1 root root 42 Mar 2 18:12 test/lib/node_modules/sqlite3 -> ../../../.npm/_cacache/tmp/git-cloneYdcsZu

Why does this matter? The Debian and Arch package both use npm install -g.

This is a regression since commit c7e504eeab4f09ef673ce896417638632dfd1ed0.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
brunnre8commented, Mar 7, 2022

Not sure why or how npm manages to fuck it up, but I must say I’ve run out of patience. If anyone has any ideas as to why npm does the symlink, I’d be very interested to hear them.

For packages I maintain, we’ll simply switch to yarn for the installation.

yarn install --frozen-lockfile
export NODE_ENV_PRODUCTION
yarn build
yarn pack --filename thelounge.tar.gz
yarn global add --frozen-lockfile --prefix /usr --global-folder /opt/thelounge file:"$(pwd)/thelounge.tar.gz"

Should do.

0reactions
brunnre8commented, Apr 9, 2022

Considering all the recent attacks from misguided developers on npm that willy nilly modify their popular packages to rm -rf /* or similar things, I suggest people only use yarn to install TL and hence (hopefully) use our lockfile.

The version lookup without that is clearly broken, recent examples:

I’m closing this, however if someone really wants to make npm work and the change on our side is sensible I’d be happy to take it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't install sqlite3 dependency with npm - node.js
If my package.json has only "sqlite3": "^5.0.2" (no any other lib) then npm install works. But if I add all other libs that...
Read more >
Installi sqlite3 (windows): node-pre-gyp install --fallback-to ...
node -v : v4.4.3 ... When I try to install sqlite3: "npm install sqlite3 -save", I get: ... The command then hangs with...
Read more >
sqlite3 - npm
To build sqlite3 for node-webkit: Install nw-gyp globally: npm install nw-gyp -g (unless already installed) Build the module with the custom ...
Read more >
Running npx sequelize init isn't working (Example) - Treehouse
I would start by checking that sequelize is installed correctly on your system. npm can be used to investigate installed packages: Use this...
Read more >
Cannot find module '@vscode/sqlite3' - Ghost Forum
Message: Ghost was able to start, but errored during boot with: Knex: run $ npm install sqlite3 --save Cannot find module '@vscode/sqlite3' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found