Meteor Docker Node.js 版本不匹配
Meteor Docker Node.js version is not match
我有一个流星 docker 刚建成,Docker 安装了 node.js 8.9.4 版本。
搭建成功后查看docker日志,说meteor需要更高的node版本(12.0以上)。错误如下:
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]$
所以我检查了我的 docker 文件,上面写着 FROM node.8.9.4,所以我将其更改为节点 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
然后重新部署它。在deploy的过程中,发现很多package在这个node版本下无法安装。比如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 && \
\
他们给出了这样的错误,我相信当我将 node.js 更改为 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.
而且我发现这些错误很难解决。我总结了一些解决方案:
- 使用旧的 meteor(1.2) 和 node.js(8.6.4)。这是我们以前的项目。
- 继续根据node.js(16.10)找出错误,这需要时间。
- 或者有什么方法可以更改 运行 docker node.js 版本?
有人擅长这个docker部署,也许可以给我一些建议。
提前谢谢你。
如果你想在 meteor 旁边安装 debian 软件包,那么你应该启动 FROM
一个 debian 映像,而不是 node
之一,然后只需从 nodesource.com 中获取节点你的 Dockerfile 并安装它,以确保你得到正确的版本。顺便说一句,如果我没记错的话,meteor 2.2 使用节点 14,还不是 16(还不是 LTS)。
在我的项目中,我为每个 Dockerfile 设置了 Meteor 版本应该使用的确切节点版本。通用版本不是一个好主意。
例如:一个Meteor App 2.4版本,我用的Node版本14.17.6
中获取 Meteor vs Node 版本
我有一个流星 docker 刚建成,Docker 安装了 node.js 8.9.4 版本。 搭建成功后查看docker日志,说meteor需要更高的node版本(12.0以上)。错误如下:
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]$
所以我检查了我的 docker 文件,上面写着 FROM node.8.9.4,所以我将其更改为节点 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
然后重新部署它。在deploy的过程中,发现很多package在这个node版本下无法安装。比如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 && \
\
他们给出了这样的错误,我相信当我将 node.js 更改为 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.
而且我发现这些错误很难解决。我总结了一些解决方案:
- 使用旧的 meteor(1.2) 和 node.js(8.6.4)。这是我们以前的项目。
- 继续根据node.js(16.10)找出错误,这需要时间。
- 或者有什么方法可以更改 运行 docker node.js 版本?
有人擅长这个docker部署,也许可以给我一些建议。 提前谢谢你。
如果你想在 meteor 旁边安装 debian 软件包,那么你应该启动 FROM
一个 debian 映像,而不是 node
之一,然后只需从 nodesource.com 中获取节点你的 Dockerfile 并安装它,以确保你得到正确的版本。顺便说一句,如果我没记错的话,meteor 2.2 使用节点 14,还不是 16(还不是 LTS)。
在我的项目中,我为每个 Dockerfile 设置了 Meteor 版本应该使用的确切节点版本。通用版本不是一个好主意。
例如:一个Meteor App 2.4版本,我用的Node版本14.17.6
中获取 Meteor vs Node 版本