Wrong node version on npm command

I’m using meteor 2.15 with node 14.21.3 and npm 6.14.18

and I’m getting an error if I run the npm run start (which is meteor --exclude-archs web.browser.legacy,web.cordova --settings settings.json --port 3000)

/.meteor/packages/meteor-tool/.3.0.3.18tkqmf.vte9++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/tools/cli/main.js:458
    throw Error("missing tool for " + archinfo.host() + " in " + toolsPkg + "@" + toolsVersion);
          ^

Error: missing tool for os.osx.x86_64 in meteor-tool@2.15.0
    at springboard (/tools/cli/main.js:498:11)
    at /tools/cli/main.js:1161:7

Node.js v20.17.0

You can see npm command is running node v20 instead of node v14. The problem started after the npm update. I reverted everything. Uninstalled nvm and installed node 14.21.3 and npm 6.14.18 manually. Now only running node 14.21.3 and npm 6.14.18 and v20 is not installed.

While running meteor --exclude-archs web.browser.legacy,web.cordova --settings settings.json --port 3000 directly (the command in npm run start) from CLI, everything works as expected.

The same npm command is working fine on Meteor.js version 3.

I think it’s not directly related to Meteor.js but I couldn’t find a solution. Is there anyone who encountered similar problem.

Debug log is:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/Users/<username>/.nvm/versions/node/v14.21.3/bin/node',
1 verbose cli   '/Users/<username>/.nvm/versions/node/v14.21.3/bin/npm',
1 verbose cli   'run',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.18
3 info using node@v14.21.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle <projectname>@~prestart: <projectname>@
6 info lifecycle <projectname>@~start: <projectname>@
7 verbose lifecycle <projectname>@~start: unsafe-perm in lifecycle true
8 verbose lifecycle <projectname>@~start: PATH: /Users/<username>/.nvm/versions/node/v14.21.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/<username>/Dev/<projectname>/node_modules/.bin:/Users/<username>/$
9 verbose lifecycle <projectname>@~start: CWD: /Users/<username>/Dev/<projectname>
10 silly lifecycle <projectname>@~start: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'meteor --settings settings.json --port 3000'
10 silly lifecycle ]
11 silly lifecycle <projectname>@~start: Returned: code: 1  signal: null
12 info lifecycle <projectname>@~start: Failed to exec start script
13 verbose stack Error: <projectname>@ start: `meteor --settings settings.json --port 3000`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/<username>/.nvm/versions/node/v14.21.3/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:400:28)
13 verbose stack     at ChildProcess.<anonymous> (/Users/<username>/.nvm/versions/node/v14.21.3/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:400:28)
13 verbose stack     at maybeClose (internal/child_process.js:1088:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
14 verbose pkgid <projectname>@
15 verbose cwd /Users/<username>/Dev/<projectname>
16 verbose Darwin 23.5.0
17 verbose argv "/Users/<username>/.nvm/versions/node/v14.21.3/bin/node" "/Users/<username>/.nvm/versions/node/v14.21.3/bin/npm" "run" "start"
18 verbose node v14.21.3
19 verbose npm  v6.14.18
20 error code ELIFECYCLE
21 error errno 1
22 error <projectname>@ start: `meteor --settings settings.json --port 3000`
22 error Exit status 1
23 error Failed at the <projectname>@ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Curious:

What is ~/.meteor/meteor a link to for you? For example:

And what meteor-tool versions do you have? For example:

image

And then if you have different versions, could you try different meteor-tool versions?

I noticed that as I go between machines ( coherence showing there ) the version of meteor-tool might be different. Makes we wonder if someone would add ( or if there already is ) a selector at the project-directory level, so you can require a meteor-tool version which stays consistent, versus a global version as shown above, decided by ~/.meteor/meteor

my meteor file is

BUNDLE_VERSION=20.18.0.1


# OS Check. Put here because here is where we download the precompiled
# bundles that are arch specific.
# Use of : "${ARCH:=$(uname)}" assignment permits users to set their
# architecture manually; this is useful for multi-arch systems whose
# uname executables may sometimes return different architectures
# in
# different contexts.
#   Ex: ARCH=arm64 meteor ARGS...;
UNAME="$(uname)"
if [ "$UNAME" != "Linux" -a "$UNAME" != "Darwin" ] ; then
    echo "Sorry, this OS is not supported."
    exit 1
fi

and the tools I have
2.15.0 2.16.0 3.0.0-rc.4 3.0.2 3.0.3 3.0.4

how can I try different tool versions?

I am still getting to know meteor-tool myself, but I suspect you can try meteor-tool@2.15.0 if you go into that package directory and run it, but I could be wrong! See reference below:

Curious if there is the ability to select meteor-tool version or pin it per project-directory, or if it is only that global soft link to ~/.meteor/packages/meteor-tool/<version> :link:

I have removed the meteor folder and reinstalled it. It seems good now. :smiling_face_with_tear: