Can't run simulation with a new brand (*Proposed Solution*)

77 views
Skip to first unread message

Mayank Pandey

unread,
Aug 18, 2021, 11:07:10 PM8/18/21
to Developing Interactive Simulations in HTML5
Hello,

I was trying to make a new brand and followed the steps available at https://github.com/phetsims/brand. However, when I tried to run my simulation with the query string "?brand=HNM", where HNM is the name of the brand's folder, I would get this error: 

Uncaught Error: Query String Machine Assertion failed: Invalid value supplied for key "brand": HNM is not a member of valid values: phet, phet-io, adapted-from-phet

I was able to fix this problem by finding my way to this path: phetsims/chipper/js/initialize-globals.js and in this file I added the string 'HNM' to the validValues Array and now it works. I was wanted to notify that this is an issue and I am not sure if my solution is a workaround or optimal. I would appreciate if someone can clarify!

Regards,
Mayank Pandey

Mayank Pandey

unread,
Aug 19, 2021, 12:09:24 AM8/19/21
to Developing Interactive Simulations in HTML5
I tried to build my simulation and I received this error:

 ~/D/p/newton-raphson  grunt build --brands=HNM                         (base)
Running "build" task
Fatal error: Perennial task failed:
AssertionError [ERR_ASSERTION] [ERR_ASSERTION]: Unknown brand: HNM
  at /Users/mayankpandey/Desktop/phetsims/chipper/js/grunt/Gruntfile.js:242:34
  at Array.forEach (<anonymous>:null:null)
  at /Users/mayankpandey/Desktop/phetsims/chipper/js/grunt/Gruntfile.js:242:16
  at Object.<anonymous> (/Users/mayankpandey/Desktop/phetsims/chipper/js/grunt/Gruntfile.js:102:13)
  at Object.thisTask.fn (/Users/mayankpandey/Desktop/phetsims/newton-raphson/node_modules/grunt/lib/grunt/task.js:70:16)
  at Object.<anonymous> (/Users/mayankpandey/Desktop/phetsims/newton-raphson/node_modules/grunt/lib/util/task.js:294:30)
  at Task.runTaskFn (/Users/mayankpandey/Desktop/phetsims/newton-raphson/node_modules/grunt/lib/util/task.js:244:24)
  at Task.<anonymous> (/Users/mayankpandey/Desktop/phetsims/newton-raphson/node_modules/grunt/lib/util/task.js:293:12)
  at Task.start (/Users/mayankpandey/Desktop/phetsims/newton-raphson/node_modules/grunt/lib/util/task.js:302:5)
  at Object.grunt.tasks (/Users/mayankpandey/Desktop/phetsims/newton-raphson/node_modules/grunt/lib/grunt.js:155:8)
  at Liftoff.<anonymous> (/usr/local/lib/node_modules/grunt-cli/bin/grunt:66:13)
  at Liftoff.execute (/usr/local/lib/node_modules/grunt-cli/node_modules/liftoff/index.js:203:12)
  at module.exports (/usr/local/lib/node_modules/grunt-cli/node_modules/flagged-respawn/index.js:51:3)
  at Liftoff.<anonymous> (/usr/local/lib/node_modules/grunt-cli/node_modules/liftoff/index.js:195:5)
  at Liftoff.<anonymous> (/usr/local/lib/node_modules/grunt-cli/node_modules/liftoff/index.js:170:7)
  at processTicksAndRejections (internal/process/task_queues.js:75:11)

I was able to fix this error by following this path: phetsims/chipper/js/common/ChipperConstants.js and updated the BRANDS array with the new brand name, however then I encountered a new error:

Fatal error: Perennial task failed:
ModuleNotFoundError: Module not found: Error: Can't resolve '../../phet-io/js/phetioEngine.js' in '/Users/mayankpandey/Desktop/phetsims/joist/js'
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/webpack/lib/Compilation.js:925:10
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/webpack/lib/NormalModuleFactory.js:401:22
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/webpack/lib/NormalModuleFactory.js:130:21
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/webpack/lib/NormalModuleFactory.js:224:22
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/neo-async/async.js:2830:7
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/neo-async/async.js:6877:13
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/webpack/lib/NormalModuleFactory.js:214:25
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:213:14
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:285:5
  at eval (<anonymous>:15:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:285:5
  at eval (<anonymous>:15:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:285:5
  at eval (<anonymous>:27:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:285:5
  at eval (<anonymous>:16:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
  at _next42 (<anonymous>:8:1)
  at eval (<anonymous>:31:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:285:5
  at eval (<anonymous>:16:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:285:5
  at eval (<anonymous>:16:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/Resolver.js:285:5
  at eval (<anonymous>:15:1)
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:27:15
  at /Users/mayankpandey/Desktop/phetsims/chipper/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:85:15
  at processTicksAndRejections (internal/process/task_queues.js:75:11)

Full Error details:
ModuleNotFoundError: Module not found: Error: Can't resolve '../../phet-io/js/phetioEngine.js' in '/Users/mayankpandey/Desktop/phetsims/joist/js'

It took me a while to figure out where the error was originating and found it was at this path: phetsims/joist/js/simLauncher.js

Where I found this block of code

if ( Tandem.PHET_IO_ENABLED ) {
  const unlockPhetioEngine = asyncLoader.createLock( { name: 'phetioEngine' } );
  import( /* webpackMode: "eager" */ '../../phet-io/js/phetioEngine.js' ).then( module => {
    phetioEngine = module.default;
    unlockPhetioEngine();
  } );
}

And I commented it out and then tried the grunt build --brands=HNM command again and it this time it worked. My concern is still the fact that this might be a makeshift workaround and so I was wondering how to actually fix the problem. I would appreciate your insight!

Thanks,
Mayank Pandey

samrreid

unread,
Aug 19, 2021, 9:03:10 PM8/19/21
to Developing Interactive Simulations in HTML5
Mayank Pandey,

Thanks so much for reporting these problems!

> Uncaught Error: Query String Machine Assertion failed: Invalid value supplied for key "brand": HNM is not a member of valid values: phet, phet-io, adapted-from-phet

I pushed a fix for this.  Please pull chipper and it will no longer require the brand to be listed in initialize-globals.js.

> It took me a while to figure out where the error was originating and found it was at this path: phetsims/joist/js/simLauncher.js

This was a separate problem that caused non-default brands to require private repos.  I corrected this with another chipper commit.

We are interested to hear what you are working on, if you would like to write to phet...@colorado.edu.

Thanks again for the helpful error reports, and our apologies for the problems.

Best Regards,
Sam
PhET Interactive Simulations

Mayank Pandey

unread,
Aug 19, 2021, 10:56:39 PM8/19/21
to Developing Interactive Simulations in HTML5
Hey Sam,

Thank you so much for the help, I really appreciate it! I would love to tell you more about the work I have been doing under my professor here at University of South Florida with the help of PhET software framework!

Regards,
Mayank Pandey.

samrreid

unread,
Aug 20, 2021, 2:02:08 PM8/20/21
to Developing Interactive Simulations in HTML5
Thanks!  This afternoon we pushed one more fix to chipper to allow the ?brand validValues to pass.

Best Regards,
Sam

Reply all
Reply to author
Forward
0 new messages