phaser-on-nodejs
phaser-on-nodejs copied to clipboard
Cannot find module 'phaser3spectorjs'
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
The error looks pretty obvious:
Error: Cannot find module 'phaser3spectorjs'
What is phaser3spectorjs btw?
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
On nodejs there is no WEBGL. So it will always be undefined.
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.
哦等。你运行的是最新的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!
i have the same issue, even when i downgrade phaser version to 3.55.2 or lower, this error still appear when compile
Related to https://github.com/photonstorm/phaser/issues/6644
I just released a new version. Try it!