So, I make a Meteor project that uses my MongoDB and other environment variables. Therefore, I create .sh file and write these down.
MONGO_URL="mongodb:<MY DATABASE>" meteor --settings settings.json
However, Meteor cannot realize the current OS is Windows, so it keeps trying to look for meteor modules using Linux’s path. Here is the error log.
Runing Meteor with configured db instance in Windows
/mnt/c/Users/mq003/AppData/Local/.meteor/packages/meteor-tool/2.2.0/mt-os.windows.x86_64/meteor: line 137: /mnt/c/Users/mq003/AppData/Local/.meteor/packages/meteor-tool/2.2.0/mt-os.windows.x86_64/dev_bundle/bin/node: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:Windowssystem32cmd.exe
npm ERR! errno ENOENT
npm ERR! simple-todos-react@ w-start: `cd buildbin && bash w-run.sh`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the simple-todos-react@ w-start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:Usersmq003AppDataRoamingnpm-cache_logs2022-12-06T17_29_40_599Z-debug.log
Does anybody know how to do this in Windows? Thank you in advance.
2
Answers
An easy way to address this is to use crossenv https://www.npmjs.com/package/cross-env
That way if you have team members using Macs and Windows, it’s the same commands, and if you get an upgrade to a Mac yourself, it’s seamless.
From what I see you have is likely with your PATH variable.
The error explicitly states it can find the Node.js in you executable directory.
Check to see if any of these identifies the problem. Or I could try to further debug .