Open pixelzoom opened 3 years ago
My response to the user in the Google Group:
Sorry that you've encountered this problem. I've reproduced the problem, and created a GitHub issue to get it resolved. See https://github.com/phetsims/perennial/issues/202.
In the meantime, you can create an empty build-local.json by opening the Terminal application on macOS, and running this command:
echo "{}" > /Users/mayankpandey/.phet/build-local.json
Let me know if that allows you to continue working.
Chris Malley PixelZoom, Inc.
I think that the error is coming from https://github.com/phetsims/perennial/blob/627e7f5c5e836721fbf2eb2fbbd37fb085fd64ac/js/grunt/decaf/deployDecaf.js#L28, because it is outside of a function, it executes upon import into perennial's Gruntfile.
I would recommend using buildLocal.js
anyways, which has built-in grace. Over to @Denz1994 who added that logic in deployDecaf.
because it is outside of a function, it executes upon import into perennial's Gruntfile.
Right, I moved these constants into the function scope of bothbuildDecaf.js
and deployDecaf.js
. This wasn't caught initially, because my machine has a .phet/build-local.json
.
I didn't use buildLocal.js
because it returns only a subset of fields from the buildLocalObject
, so fields like buildLocalObject.gitRoot
don't carry over. Instead, I added assertions to check for these fields where they are needed in buildDecaf.js
and deployDecaf.js
.
This was tested by removing my build-local.json
and running grunt create-sim
and grunt lint
, where both tasks completed successfully. Assigning @samreid for review since we initially paired on this task.
Looks great and I also tested after renaming by local file, closing.
I didn't use buildLocal.js because it returns only a subset of fields from the buildLocalObject, so fields like buildLocalObject.gitRoot don't carry over.
In my opinion, buildLocal.js
should be the entire schema of what can be found in build-local.json on master. I think it would be better and clearer to add this field to buildLocal with a reasonable default instead of using a separate implementation of the same job. Perhaps another issue should be created for this though.
Another solution would be to alert buildLocal.js so that it returns whatever is in buildLocal, but _.extends()
defaults so that you could use buildLocal.js
without adding to that file, and still include the assertions where you have them.
Good point @zepumph, I agree.
Reported by a 3rd-party in the Google Group, https://groups.google.com/d/topic/developing-interactive-simulations-in-html5/zBt-qQQVbkM?pli=1&authuser=0:
I have reproduced this problem. If $HOME/.phet/build-local.json doesn't exist, then
grunt create-sim
(and possibly other tasks) will fail.I don't know how to fix this problem. But I will instruct the user on how to create an empty $HOME/.phet/build-local.json, since this is a blocking issue for them.
Assigning to @ariel-phet for prioritization and assignment. Recommended high priority.