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

npm install sqlite3 -g fails only with snapped node 18 or 19 #56

Open
nobuto-m opened this issue Jul 26, 2023 · 1 comment
Open

npm install sqlite3 -g fails only with snapped node 18 or 19 #56

nobuto-m opened this issue Jul 26, 2023 · 1 comment

Comments

@nobuto-m
Copy link

With the binary distribution, it just works. But when using a snap, the sqlite3 package fails to install. It's worth noting that the issue does NOT happen with the 20/stable channel with core22.

binary distribution with LTS (v18.x)

$ lsb_release -d
Description:    Ubuntu 22.04.2 LTS

$ curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

$ type -a node; node -v; type -a npm; npm -v
node is /usr/bin/node
node is /bin/node
v18.17.0
npm is /usr/bin/npm
npm is /bin/npm
9.6.7
$ sudo -H npm install sqlite3 -g
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs

added 105 packages in 5s

5 packages are looking for funding
  run `npm fund` for details
npm notice 
npm notice New minor version of npm available! 9.6.7 -> 9.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.8.1
npm notice Run npm install -g [email protected] to update!
npm notice 

-> succeeds

snap with 18/stable channel

$ lsb_release -d
Description:    Ubuntu 22.04.2 LTS

$ sudo snap install --classic node --channel 18/stable

$ type -a node; node -v; type -a npm; npm -v
node is /snap/bin/node
v18.16.1
npm is /snap/bin/npm
9.5.1
$ sudo -H npm install sqlite3 -g
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm notice 
npm notice New minor version of npm available! 9.5.1 -> 9.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.8.1
npm notice Run npm install -g [email protected] to update!
npm notice 
npm ERR! code 1
npm ERR! path /usr/local/lib/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-07-26T10_17_43_325Z-debug-0.log

-> installation error

[/root/.npm/_logs/2023-07-26T10_17_43_325Z-debug-0.log]

784 timing build:queue Completed in 7ms
785 timing build:link:node_modules/sqlite3/node_modules/@mapbox/node-pre-gyp Completed in 6ms
786 timing build:link:node_modules/sqlite3/node_modules/make-dir/node_modules/semver Completed in 4ms
787 timing build:link:node_modules/sqlite3/node_modules/color-support Completed in 6ms
788 timing build:link:node_modules/sqlite3/node_modules/mkdirp Completed in 6ms
789 timing build:link:node_modules/sqlite3/node_modules/node-gyp Completed in 6ms
790 timing build:link:node_modules/sqlite3/node_modules/nopt Completed in 6ms
791 timing build:link:node_modules/sqlite3/node_modules/rimraf Completed in 5ms
792 timing build:link:node_modules/sqlite3/node_modules/semver Completed in 5ms
793 timing build:link:node_modules/sqlite3/node_modules/which Completed in 5ms
794 timing build:link Completed in 7ms
795 info run [email protected] install node_modules/sqlite3 node-pre-gyp install --fallback-to-build
796 info run [email protected] install { code: 1, signal: null }
797 timing reify:rollback:createSparse Completed in 86ms
798 timing reify:rollback:retireShallow Completed in 0ms
799 timing command:install Completed in 7208ms
800 notice
800 notice New minor version of npm available! 9.5.1 -> 9.8.1
800 notice Changelog: https://github.com/npm/cli/releases/tag/v9.8.1
800 notice Run npm install -g [email protected] to update!
800 notice
801 verbose stack Error: command failed
801 verbose stack     at ChildProcess.<anonymous> (/snap/node/7588/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
801 verbose stack     at ChildProcess.emit (node:events:513:28)
801 verbose stack     at maybeClose (node:internal/child_process:1091:16)
801 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
802 verbose pkgid [email protected]
803 verbose cwd /home/ubuntu
804 verbose Linux 5.15.0-75-generic
805 verbose node v18.16.1
806 verbose npm  v9.5.1
807 error code 1
808 error path /usr/local/lib/node_modules/sqlite3
809 error command failed
810 error command sh -c node-pre-gyp install --fallback-to-build
811 verbose exit 1
812 timing npm Completed in 7237ms
813 verbose unfinished npm timer reify 1690366663352
814 verbose unfinished npm timer reify:build 1690366670327
815 verbose unfinished npm timer build 1690366670328
816 verbose unfinished npm timer build:deps 1690366670328
817 verbose unfinished npm timer build:run:install 1690366670343
818 verbose unfinished npm timer build:run:install:node_modules/sqlite3 1690366670343
819 verbose code 1

[kern.log]

Jul 26 10:17:50 n8n kernel: audit: type=1400 audit(1690366670.405:37): apparmor="DENIED" operation="file_inherit" profile="/snap/snapd/19361/usr/lib/snapd/snap-confine" pid=9854 comm="snap-confine" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none
Jul 26 10:17:50 n8n kernel: audit: type=1400 audit(1690366670.405:38): apparmor="DENIED" operation="file_inherit" profile="/snap/snapd/19361/usr/lib/snapd/snap-confine" pid=9854 comm="snap-confine" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none
Jul 26 10:17:50 n8n kernel: audit: type=1400 audit(1690366670.405:39): apparmor="DENIED" operation="file_inherit" profile="/snap/snapd/19361/usr/lib/snapd/snap-confine" pid=9854 comm="snap-confine" family="unix" sock_type="stream" protocol=0 requested_mask="send receive" denied_mask="send receive" addr=none peer_addr=none
@rvagg
Copy link
Member

rvagg commented Aug 7, 2023

Unfortunately there's some problems using the snap to build and load addons; we don't have good answers for this that aren't hacky, so generally it's best, if you're using compiled addons, to not use the snap, but to use a directly installed form.

See the issue tracker here for other related discussions and people's workarounds.

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