Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module 'phaser3spectorjs' #19

Open
kpotschi opened this issue May 2, 2023 · 8 comments
Open

Cannot find module 'phaser3spectorjs' #19

kpotschi opened this issue May 2, 2023 · 8 comments

Comments

@kpotschi
Copy link

kpotschi commented May 2, 2023

Describe the bug
Using a minimal setup, the compilter throws the following error

[1] Error: Cannot find module 'phaser3spectorjs'
[1] Require stack:
[1] - /Users/kevinsensory/Coding/test/node_modules/phaser/src/renderer/webgl/WebGLRenderer.js
[1] - /Users/kevinsensory/Coding/test/node_modules/phaser/src/renderer/webgl/index.js
[1] - /Users/kevinsensory/Coding/test/node_modules/phaser/src/renderer/index.js

the setup looks like this, but is basically pulled from the github documentation, minus the audio flag in the config, it seems to be deprecated.

require('@geckos.io/phaser-on-nodejs')
import Phaser from 'phaser'

// set the fps you need
const FPS = 30
global.phaserOnNodeFPS = FPS // default is 60

// your MainScene
class MainScene extends Phaser.Scene {
    constructor() {
        super('MainScene')
    }
    create() {
        console.log('it works!')
    }
}

// prepare the config for Phaser
const config = {
    type: Phaser.HEADLESS,
    width: 1280,
    height: 720,
    banner: false,
    scene: [MainScene],
    fps: {
        target: FPS,
    },
    physics: {
        default: 'arcade',
        arcade: {
            gravity: { y: 300 },
        },
    },
}

// start the game
new Phaser.Game(config)

I'm able to get it to run commenting out

if (typeof WEBGL_DEBUG)
{
    var SPECTOR = require('phaser3spectorjs');
    DEBUG = true;
}

in node_modules/phaser/src/renderer/webgl/WebGLRenderer.js

@yandeu
Copy link
Member

yandeu commented May 2, 2023

The error looks pretty obvious:
Error: Cannot find module 'phaser3spectorjs'

What is phaser3spectorjs btw?

@kpotschi
Copy link
Author

kpotschi commented May 2, 2023

it's some sort of debug tool as far as I understand?

Unfortunately this might be above my understanding, but the fact that Phaser itself runs without a problem, but the error shows up when using phaser-on-nodejs, I was wondering if there's some flag that needs to be set in order for WEBGL_DEBUG not to be undefined

@yandeu
Copy link
Member

yandeu commented May 2, 2023

On nodejs there is no WEBGL. So it will always be undefined.

@yandeu
Copy link
Member

yandeu commented May 2, 2023

Ooh wait. Are you running the latest 3.60 Phaser version?
This library is not yet adapted to 3.60.
Works with Phaser <3.50.0 and >=3.55.2.

Maybe you want to try arcade-physics instead.

@ghlds
Copy link

ghlds commented Jun 1, 2023

哦等。你运行的是最新的3.60 Phaser版本吗? 这个库还没有配到3.60。 Works with Phaser <3.50.0 and >=3.55.2.

也许你想考机械物理学

I hope it will support the 3.60.0,It's great!

@hongha1412
Copy link

i have the same issue, even when i downgrade phaser version to 3.55.2 or lower, this error still appear when compile

@yandeu
Copy link
Member

yandeu commented Oct 7, 2023

Related to phaserjs/phaser#6644

@yandeu
Copy link
Member

yandeu commented Oct 10, 2023

I just released a new version. Try it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants