View in the Browser

38 views
Skip to first unread message

Salim Shaban

unread,
Oct 26, 2022, 6:02:51 PM10/26/22
to Developing Interactive Simulations in HTML5
Guys I'm in the process of getting the source code for one of the Sim , but after git cloning all github repo I'm find it hard to view my sim in the browser ....

Im stuck by the proccess where it say

====  (4) In a new terminal/command prompt, start an http-server and or will probably need to modify this URL based on your HTTP port and relative path

plz help guyd

samrreid

unread,
Oct 27, 2022, 10:15:36 AM10/27/22
to Developing Interactive Simulations in HTML5
Are you using mac, windows or linux? Please show what command you entered into the terminal and what its response was.

Best Regards,
Sam

Salim Shaban

unread,
Nov 7, 2022, 9:37:32 AM11/7/22
to Developing Interactive Simulations in HTML5
I'm using a windows pc , after i type npm start it gives me this error that i'm missing a start script and i already have iterror.jpeg
Message has been deleted

martin.v...@gmail.com

unread,
Nov 8, 2022, 8:22:14 AM11/8/22
to Developing Interactive Simulations in HTML5
Hello,

You run a PC. You are using Visual studio Code and you have a powershell terminal opened. From the LHS, it looks as if you have cloned the github repos correctly.
You can't run the simulation without running a http-server. At this point the simulation is made of hundreds of small modules in may different files. You need a server to run the simulation.   

====  (4) In a new terminal/command prompt, start an http-server and or will probably need to modify this URL based on your HTTP port and relative path

It means that you need to run an http-server. There are many ways to do it and the above instruction are not very prescriptive about how to do it.  Since you seem to be familiar with npm, you can install an http-server with the command line (in powershell)

npm install --global http-server

This command need to be issued in a terminal, like the one you have at the bottom of your screenshot. 

The next step is to launch the http-server. For this purpose, you need to invoke it from the "root" directory of your project. In your case the root directory is called "the balance". 

From the balancing-act directory, you issue in your powershell terminal

cd ..
http-server
 
At this point, the http-server will start and list some URL. Using a browser, enter the url listed by the http-server. The browser will display the directory structure of the root directory. From the browser, click on balancing-act folder, and then balancing-act_en.html.  It should run the simulation at this point.

Best
Martin Veillette




martin.v...@gmail.com

unread,
Nov 8, 2022, 9:36:59 AM11/8/22
to Developing Interactive Simulations in HTML5
Hello,

One more thing.  From the quoted line (4), it looks as if the instructions you are following might be a bit stale. 
You can find up to date instructions at https://github.com/phetsims/balancing-act 

You will need to transpile the code (step 3 below) before you can start the http-server



````

(1) Clone the simulation and its dependencies:

git clone https://github.com/phetsims/assert.git git clone https://github.com/phetsims/axon.git git clone https://github.com/phetsims/babel.git git clone https://github.com/phetsims/balancing-act.git git clone https://github.com/phetsims/brand.git git clone https://github.com/phetsims/chipper.git git clone https://github.com/phetsims/dot.git git clone https://github.com/phetsims/joist.git git clone https://github.com/phetsims/kite.git git clone https://github.com/phetsims/perennial.git perennial-alias git clone https://github.com/phetsims/phet-core.git git clone https://github.com/phetsims/phetcommon.git git clone https://github.com/phetsims/phetmarks.git git clone https://github.com/phetsims/query-string-machine.git git clone https://github.com/phetsims/scenery.git git clone https://github.com/phetsims/scenery-phet.git git clone https://github.com/phetsims/sherpa.git git clone https://github.com/phetsims/sun.git git clone https://github.com/phetsims/tambo.git git clone https://github.com/phetsims/tandem.git git clone https://github.com/phetsims/twixt.git git clone https://github.com/phetsims/utterance-queue.git git clone https://github.com/phetsims/vegas.git

(2) Install dev dependencies:

cd chipper npm install 
cd ../perennial-alias npm install 
cd ../balancing-act npm install

(3) Change directory to chipper cd ../chipper/, then transpile the code to JavaScript by running node js/scripts/transpile.js --watch. This starts a file-watching process that will automatically transpile new or changed files.

(4) In a new terminal/command prompt, start an http-server

(5) Open in the browser: http://localhost/balancing-act/balancing-act_en.html (You will probably need to modify this URL based on your HTTP port and relative path.)


Reply all
Reply to author
Forward
0 new messages