Reputation: 11
I am not a developer but I am asked to migrate a release 1.3.4.1 Meteor deployment to a new (CentOS 7) platform. The original company vanished and the app developer is gone and not cooperating ... :( Only thing as far as I know is the release.
When I run the following command on the new server:
meteor run --port 3000 --release 1.3.4.1
I see a lot of things (downloading packages, building, linking, ..) running well but after some minutes I end up with a syntax error in the build modules.js when the app is started:
[meteor@rfcwerkboek rfc-project]$ meteor run --port 3000 --release 1.3.4.1
[[[[[ ~/prod/rfc-project ]]]]]
=> Started proxy.
W20190116-00:49:49.745(1)? (STDERR)
W20190116-00:49:50.037(1)? (STDERR) /home/meteor/prod/rfc-project/.meteor/local/build/programs/server/packages/modules.js:26622
W20190116-00:49:50.038(1)? (STDERR) matches.forEach(nextMatch => {
W20190116-00:49:50.038(1)? (STDERR) ^
W20190116-00:49:50.039(1)? (STDERR) SyntaxError: Unexpected token >
W20190116-00:49:50.039(1)? (STDERR) at /home/meteor/prod/rfc-project/.meteor/local/build/programs/server/boot.js:292:30
W20190116-00:49:50.040(1)? (STDERR) at Array.forEach (native)
W20190116-00:49:50.041(1)? (STDERR) at Function._.each._.forEach (/home/meteor/.meteor/packages/meteor-tool/.1.3.4_1.wmvsc.7d2bga++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20190116-00:49:50.041(1)? (STDERR) at /home/meteor/prod/rfc-project/.meteor/local/build/programs/server/boot.js:133:5
=> Exited with code: 8
The piece of code in modules.js where the syntax error occurs is:
var fileFound = null;
matches.forEach(nextMatch => {
if( fileFound !== null ) return;
if( nextMatch[1].length < 1 ){
fileFound = new Buffer(0);
return;
}
Removing the build and starting the process again does not solve the issue.
Just some now a I discovered a file called .node_version.txt in .meteor/local/build/ which says:
v0.10.45
My new CentOS 7 distro has nodejs version:
[meteor@rfcwerkboek rfc-project]$ node --version
v6.14.3
I guess that's probably the cause of the problem. Am I right? If I am right should I downgrade nodejs by removing the standard nodejs RPM's and compile and old version from scratch?
Upvotes: 1
Views: 322
Reputation: 8413
Meteor is shipped with a builtin node
binary, so you don't require a node
installation at your development system.
However, if your CentOS is your targeted server where your app will be deployed you need the exact node
version to be installed in order to execute your bundled app (but no Meteor install is required on the server).
Background
Meteor itself is mainly a development framework, which combines good practices and tools and bundles all that code into a node application, that runs like every other node application.
In oder to get the node version, that is required to be installed on your server you can go to your project directory and let Meteor print it's node version:
$ cd myproject
$ meteor node -v
0.10.45
which would be for example the node version for a Meteor 1.7 release. So if you want to run your build on your server it requires this node version.
Note, that if the version from the command differs with the one from the .node_version.text
then the version you receive from meteor node -v
is the one that is used when running meteor build
and that should be installed on the server.
The Meteor guide on custom deployment is summarizing this in an understandable way and should be consulted as further readig. Resolving this issue should also solve the error.
Long story short
node
binarynode
installationmeteor npm <command>
node
version as the one that is shipped with MeteorUpvotes: 1