bgstaal / multipleWindow3dScene

A quick example of how one can "synchronize" a 3d scene across multiple windows using three.js and localStorage
MIT License
16.44k stars 2.56k forks source link

How do we run this? #2

Open MrYossu opened 9 months ago

MrYossu commented 9 months ago

Sorry if this is a dumb question, but how do we run this code?

I tried loading the html file in a browser, but got errors in the browser console...

Access to script at 'file:///D:/multipleWindow3dScene-main/main.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome-untrusted, https, edge. main.js:1

Failed to load resource: net::ERR_FAILED

Please advise (in simple terms!) how we run this amazing code.

Thanks

nigelreign commented 9 months ago

HOW TO RUN THE PROJECT

Install http-server:

    npm install http-server

Navigate to the project directory:

    cd multipleWindow3dScene

Start the local server:

    http-server

Open the project in your browser:

    Starting up http-server, serving ./
    Available on:
    http://127.0.0.1:8080
    http://192.168.1.10:8080
MrYossu commented 9 months ago

Great thanks, will give it a go

b3n-j3ffr3y commented 9 months ago

You need to install http-server globally. With npm install -g http-server

hhhyw commented 9 months ago

哈哈哈哈 如果是用的vscode , 安装了live-serve插件, 直接 ctrl+l 再按o就好了

yunfengsa commented 9 months ago

python -m http.server 9000

Molaryy commented 9 months ago

If you are using vscode, you can install the extension Live Server, go to your inde.html and at the bottom of your window you will find a button Go live, then go to http://localhost:5500/index.html and you will get your page :D.

julianfere commented 9 months ago

If you are using Visual Studio Code you can install the extension Live Server and use it with the index.html file

Danielg212 commented 8 months ago

run npx http-server

liushengrui527 commented 8 months ago
npm install http-server
cd multipleWindow3dScene
http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
http://192.168.1.10:8080
liudonghua123 commented 8 months ago

I use npx serve ., but only a simple cube shown in the page, nothing errors in the console of devtools.

See also https://github.com/bgstaal/multipleWindow3dScene/issues/17#issuecomment-1827209984.

ok-coder1 commented 8 months ago

Easier way, use the website created by the creator himself: https://bgstaal.github.io/multipleWindow3dScene/

ok-coder1 commented 8 months ago

BTW, close this issue.

Mujtaba-12390 commented 8 months ago

1) If you are new firstly download, Node JS by searching on the browser and downloading (.msi) file

2) After downloading successfully, Search Enviorment Variable on Start and click "Enviorment Variable" and then click New.. Afterward save your Node Js location into it. In my case ("C:\Program Files\nodejs") and click save.

3) Then open cmd and Clone the repository

4) ->Install http-server:

"    npm install http-server
"

5) ->Navigate to the project directory:

"
       cd multipleWindow3dScene
"

6) ->Start the local server:

"
       http-server
"

7) ->Open the project in your browser:

"
  Open browser and search for 
    http://127.0.0.1:8080
    http://192.168.1.10:8080
"
Lobohombo commented 8 months ago

Espero que los siguientes datos sean para la vejez de México en mi idioma gracias

Único dueñoDarioRodolfo

El mar., 28 de noviembre de 2023 20:37, Muhammad Mujtaba Raza < @.***> escribió:

  1. If you are new firstly download, Node JS by searching on the browser and downloading (.msi) file
  2. After downloading successfully, Search Enviorment Variable on Start and click "Enviorment Variable" and then click New.. Afterward save your Node Js location into it. In my case ("C:\Program Files\nodejs") and click save.
  3. Then open cmd and Clone the repository
  4. Install http-server:

" npm install http-server " 5) ## Navigate to the project directory: " cd multipleWindow3dScene " 6) ## Start the local server: " http-server " 7) ## Open the project in your browser: " Open browser and search for http://127.0.0.1:8080 http://192.168.1.10:8080 "

— Reply to this email directly, view it on GitHub https://github.com/bgstaal/multipleWindow3dScene/issues/2#issuecomment-1831119150, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEJM2TMCEAGDQS2HK6522GLYG2NXFAVCNFSM6AAAAAA7YDORKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZRGEYTSMJVGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

vxedit commented 7 months ago

python -m http.server 9000

i also tried with python python -m http.server http://localhost:8000/ but its loading a cube if i open in sec window with http://localhost:8000/ it adds another rotating cube over it

NilsBaumgartner1994 commented 5 months ago
npm install http-server
cd multipleWindow3dScene
http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
http://192.168.1.10:8080

Worked like a charm on mac