skip to Main Content

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


  1. An easy way to address this is to use crossenv https://www.npmjs.com/package/cross-env

    cross-env makes it so you can have a single command without worrying about setting or using the environment variable properly for the platform. Just set it like you would if it’s running on a POSIX system, and cross-env will take care of setting it properly.

    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.

    Login or Signup to reply.
  2. 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 .

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search