Home > database >  Meteor Docker Node.js version is not match
Meteor Docker Node.js version is not match

Time:10-10

I have a meteor docker just built,the Docker is installed with node.js version 8.9.4. After successfully built, I check the docker log, it said the meteor requires a higher node version (12.0 above). Error like this:

data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - /app/bundle/programs/server/mini-files.js:1
data:    /app/bundle/main.js:34 - (function (exports, require, module, __filename, __dirname) { module.export({
data:    /app/bundle/main.js:34 -                                                                            ^
data:    /app/bundle/main.js:34 - TypeError: module.export is not a function
data:    /app/bundle/main.js:34 -     at Object.<anonymous> (/app/bundle/programs/server/mini-files.js:1:76)
data:    /app/bundle/main.js:34 -     at Module._compile (module.js:643:30)
data:    /app/bundle/main.js:34 -     at Object.Module._extensions..js (module.js:654:10)
data:    /app/bundle/main.js:34 -     at Module.load (module.js:556:32)
data:    /app/bundle/main.js:34 -     at tryModuleLoad (module.js:499:12)
data:    /app/bundle/main.js:34 -     at Function.Module._load (module.js:491:3)
data:    /app/bundle/main.js:34 -     at Module.require (module.js:587:17)
data:    /app/bundle/main.js:34 -     at require (internal/module.js:11:18)
data:    /app/bundle/main.js:34 -     at Object.<anonymous> (/app/bundle/programs/server/boot.js:14:15)
data:    /app/bundle/main.js:34 -     at Object.<anonymous> (/app/bundle/programs/server/boot.js:469:3)
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - error: Script restart attempt #1
data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - /app/bundle/programs/server/mini-files.js:1
data:    /app/bundle/main.js:34 - (function (exports, require, module, __filename, __dirname) { module.exports({
data:    /app/bundle/main.js:34 -                                                                      ^
data:    /app/bundle/main.js:34 - TypeError: module.exports is not a function
data:    /app/bundle/main.js:34 -     at Object.<anonymous> (/app/bundle/programs/server/mini-files.js:1:70)
data:    /app/bundle/main.js:34 -     at Module._compile (module.js:643:30)
data:    /app/bundle/main.js:34 -     at Module.Mp._compile (/app/bundle/programs/server/runtime.js:50:23)
data:    /app/bundle/main.js:34 -     at Object.Module._extensions..js (module.js:654:10)
data:    /app/bundle/main.js:34 -     at Module.load (module.js:556:32)
data:    /app/bundle/main.js:34 -     at Module.Mp.load (/app/bundle/programs/server/runtime.js:15:31)
data:    /app/bundle/main.js:34 -     at tryModuleLoad (module.js:499:12)
data:    /app/bundle/main.js:34 -     at Function.Module._load (module.js:491:3)
data:    /app/bundle/main.js:34 -     at Module.require (module.js:587:17)
data:    /app/bundle/main.js:34 -     at require (internal/module.js:11:18)
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
data:    /app/bundle/main.js:34 - error: Script restart attempt #1
data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
error:   undefined
data:    /app/bundle/main.js:34 - Meteor requires Node v12.0.0 or later.
data:    /app/bundle/main.js:34 - error: Forever detected script exited with code: 1
(base) [wangz35@ehslocvld01 tblBuilder]$ 

So I checked my dockerfile, it said FROM node.8.9.4, so I changed it to node 16.10.0.

# node version dependent on meteor version
#FROM node:8.9.4

## node 16.10.0 is used for meteor 2.2, check release file.
FROM node:16.10.0

Then redeploy that. During deploy, I found a lot of package can not be installed during this node version. Such as jessie-backport, jessie.

RUN \
    echo "deb [check-valid-until=no] http://cdn-fastly.deb.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list   && \
    echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list && \
    sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list && \
    apt-get -o Acquire::Check-Valid-Until=false update && \
    \

They gave errors like this, I am sure those error will not come out when I change node.js to 8.9.4:

W: GPG error: http://cdn-fastly.deb.debian.org/debian jessie Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 7638D0442B90D010 NO_PUBKEY CBF8D6FD518E17E1
 out: E: The repository 'http://cdn-fastly.deb.debian.org/debian jessie Release' is not signed.
 out: W: GPG error: http://archive.debian.org/debian jessie-backports InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 8B48AD6246925553 NO_PUBKEY 7638D0442B90D010
 out: E: The repository 'http://archive.debian.org/debian jessie-backports InRelease' is not signed.

And I found those errors are hard to solve. I have concluded some solutions:

  1. Use an older meteor(1.2) with node.js(8.6.4). This is our project used to be.
  2. Keep figure out error based on node.js (16.10), which will take time.
  3. Or is there some way I can change the running docker node.js version?

Anyone is good at this docker deploy, maybe can give me some advise. Thank you in advance.

CodePudding user response:

If you want to install debian packages alongside meteor then you should start FROM a debian image, not one of the node ones, and then just fetch node from nodesource.com in your Dockerfile and install it, to be sure you get the correct version. By the way, meteor 2.2 uses node 14 if I'm not mistaken, not yet 16 (which is not LTS yet).

CodePudding user response:

In my projects, each Dockerfile I set the exact version of Node that Meteor version should be using. Generic version isn't a good idea.

For example: a Meteor App version 2.4, I use the Node version 14.17.6

You can getting Meteor vs Node version in the Meteor Changelog documentation

  • Related