Hi everyone - I’m having trouble setting up my project to use a local meteor package instead of a “remote” one. The meteor package I’m trying to use locally is a copy of meteortesting:mocha (so I can put my own logs into it).
Here’s what I’ve done:
Git cloned the meteortesting:mocha repo onto my machine
Copied the repo into my project root folder with cp -r [PATH]/meteor-mocha **.**
Set METEOR_PACKAGE_DIRS=./meteor-mocha
But when I run “meteor add meteortesting:mocha” (which is the name of my local package in ./meteor-mocha/package/package.js) it still adds the registered/online meteortesting:mocha package instead of finding my local one.
I also tried fooling around with the name of my local package (i.e. name:“meteortesting:mochalocal”) to differentiate it, but when I ran meteor add meteortesting:mochalocal it gives the error “error: no such package”
Does anyone know why this may be the case? I based my set up on this article
I’ve never tried setting METEOR_PACKAGE_DIRS to point directly to the package path, so I’m not sure if that is supported or not. Usually METEOR_PACKAGE_DIRS is set to the parent directory of the local packages.
Another option is to create a packages folder in the root of the Meteor app, and put the meteor-mocha folder in there.
Thanks for the tips zodern & paulishca - however it seems to still not be working when I use that folder structure. Here I place the meteor-mocha folder inside root/package and it doesn’t find my package (which I’ve renamed “meteortesting:mochalocal”):
For good measure I also point $METEOR_PACKAGE_DIRS at root/packages, which you can see in the terminal.
One thought I explored - maybe it’s having issues because of the structure of the meteor-mocha folder. As seen here, this folder has its package.js within a sub-folder “package”. Therefore, the folder structure to get to my local package’s package.js when I add meteor-mocha within root/packages is root/packages/meteor-mocha/package/package.js.
So I tried to add just the “package” sub-folder of meteor-mocha directly into root/packages (so package.js is found at root/packages/package/package.js) which made it find my local package, but gave an error re the ECMA package being used when I try to ‘meteor add’ it:
I tried taking out the ecmascript from api.use defined in the package.js of my local package, which allowed me to add the local package, but then gives an error regarding modules & imports (I assume because ecmascript is now missing) when I try to run tests with it as the driver:
Does this approach of adding just the “package” sub-folder of meteor-mocha sound correct and worth troubleshooting? Or will it need those “outside” files (i.e. package.json, test.sh, .circleci) to operate correctly?
Ok, just uncomment the ecmascript and remove the package version ‘@0.15.1’
Also, I am not sure whether you have the ecmascript package added to your Meteor packages. My projects are running with these installed versions of ecmas (on Meteor 2.7)