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 installation fails with Node.js 18 or 19 #6740

Closed
nobuto-m opened this issue Jul 26, 2023 · 7 comments
Closed

npm installation fails with Node.js 18 or 19 #6740

nobuto-m opened this issue Jul 26, 2023 · 7 comments

Comments

@nobuto-m
Copy link

Describe the bug
npm installation fails with Node.js 18 or 19 although the official installation doc states "n8n requires Node.js 18 or above".
https://docs.n8n.io/hosting/installation/npm/

To Reproduce
Steps to reproduce the behavior:

  1. Prepare Ubuntu 22.04 LTS machine
  2. Install Node.js 18 sudo snap install node --classic --channel 18
  3. Run sudo -H npm install n8n -g
  4. See error
$ node -v; npm -v
v18.16.1
9.5.1

$ sudo -H npm install n8n -g

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

6820 info run sqlite3@5.1.6 install node_modules/n8n/node_modules/sqlite3 node-pre-gyp install --fallback-to-build
6821 info run msgpackr-extract@3.0.2 install { code: 0, signal: null }
6822 timing build:run:install:node_modules/n8n/node_modules/msgpackr-extract Completed in 198ms
6823 info run ssh2@1.14.0 install node_modules/n8n/node_modules/ssh2 node install.js
6824 info run sqlite3@5.1.6 install { code: 1, signal: null }
6825 info run ssh2@1.14.0 install { code: 0, signal: null }
6826 timing build:run:install:node_modules/n8n/node_modules/ssh2 Completed in 545ms
6827 timing reify:rollback:createSparse Completed in 2749ms
6828 timing reify:rollback:retireShallow Completed in 1ms
6829 timing command:install Completed in 79809ms
6830 verbose stack Error: command failed
6830 verbose stack     at ChildProcess.<anonymous> (/snap/node/7588/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
6830 verbose stack     at ChildProcess.emit (node:events:513:28)
6830 verbose stack     at maybeClose (node:internal/child_process:1091:16)
6830 verbose stack     at Socket.<anonymous> (node:internal/child_process:449:11)
6830 verbose stack     at Socket.emit (node:events:513:28)
6830 verbose stack     at Pipe.<anonymous> (node:net:322:12)
6831 verbose pkgid sqlite3@5.1.6
6832 verbose cwd /home/ubuntu
6833 verbose Linux 5.15.0-75-generic
6834 verbose node v18.16.1
6835 verbose npm  v9.5.1
6836 error code 1
6837 error path /usr/local/lib/node_modules/n8n/node_modules/sqlite3
6838 error command failed
6839 error command sh -c node-pre-gyp install --fallback-to-build
6840 verbose exit 1
6841 timing npm Completed in 79841ms

It's reproducible with the following combination:

$ sudo snap refresh node --channel 19
$ node -v; npm -v
v19.9.0
9.6.3

But it succeeds with the following in the meantime:

$ sudo snap refresh node --channel 20
$ node -v; npm -v
v20.5.0
9.8.0

Expected behavior
Installation completes without any error.

Environment (please complete the following information):

  • OS: Ubuntu 22.04 LTS
  • n8n Version 1.0.5
  • Node.js Version v18.16.1
  • Database system SQLite
  • Operation mode [e.g. own; operation modes are own, main and queue. Default is main]

Additional context

Node.js >= 18 looks like a relatively new requirement by #6649. However in my environment, it seems only Node.js >= 20 works. So if that's the case, it would be nice to update the official doc and package.json to avoid a confusion.

@Joffcom
Copy link
Member

Joffcom commented Jul 26, 2023

Hey @nobuto-m,

Thanks for the report we have supported node 18 for a while and our docker images have moved to it for the official releases more recently.

It looks like something is going on when trying to install the SQLite package, what hardware are you installing n8n on?

@nobuto-m
Copy link
Author

It looks like something is going on when trying to install the SQLite package, what hardware are you installing n8n on?

I initially suspected OOM when building the SQLite. But it's reliably reproducible with a clean VM with 2 CPU cores and 8GB memory with the AMD64 (x86_64) architecture.

@netroy
Copy link
Member

netroy commented Jul 26, 2023

I suspect this is an issue with snap.
Can you please try installing node 18 via nvm instead?

@Joffcom
Copy link
Member

Joffcom commented Jul 26, 2023

That is interesting, I have just given it a quick go and for me it is installing as expected. As Netroy mentioned I have been using NVM over Snap as I have had issues with that in the past with other projects.

image

@nobuto-m
Copy link
Author

I suspect this is an issue with snap. Can you please try installing node 18 via nvm instead?

Yup, that makes sense as a culprit. I will try it later and please consider this report as incomplete as it might be only a snap environment issue.

@nobuto-m
Copy link
Author

Okay it was nothing to do with n8n so I moved this to nodejs/snap#56

@nobuto-m nobuto-m closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2023
@Joffcom
Copy link
Member

Joffcom commented Jul 26, 2023

@nobuto-m thanks for the update.

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

3 participants