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 read property 'getUniformLocation' of null #213

Closed
weihao opened this issue Aug 10, 2021 · 2 comments
Closed

Cannot read property 'getUniformLocation' of null #213

weihao opened this issue Aug 10, 2021 · 2 comments

Comments

@weihao
Copy link

weihao commented Aug 10, 2021

Example demo code does not run, any ideas why? node-canvas-webgl is installed globally

GitHub/prismarine-viewer/examples/exporter$ node screenshot.js
THREE.WebGLRenderer: Cannot read property 'getUniformLocation' of null
(node:1052) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'getUniformLocation' of null
    at NodeCanvasElement.getContext (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/node-canvas-webgl/lib/canvas.js:88:39)
    at getContext (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17304:29)
    at new WebGLRenderer (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17335:11)
    at main (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/examples/exporter/screenshot.js:25:20)
    at Object.<anonymous> (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/examples/exporter/screenshot.js:59:1)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1052) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1052) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code
prismarine-viewer/examples$ node headless.js 
THREE.WebGLRenderer: Cannot read property 'getUniformLocation' of null
/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17358
                        throw error;
                        ^

TypeError: Cannot read property 'getUniformLocation' of null
    at NodeCanvasElement.getContext (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/node-canvas-webgl/lib/canvas.js:88:39)
    at getContext (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17304:29)
    at new WebGLRenderer (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17335:11)
    at module.exports (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/lib/headless.js:19:20)
    at EventEmitter.<anonymous> (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/examples/headless.js:10:3)
    at Object.onceWrapper (events.js:481:28)
    at EventEmitter.emit (events.js:387:35)
    at Client.<anonymous> (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/mineflayer/lib/plugins/health.js:13:11)
    at Object.onceWrapper (events.js:482:26)
    at Client.emit (events.js:387:35)
[nodemon] starting `node firstperson_bot.js`
THREE.WebGLRenderer: Cannot read property 'getUniformLocation' of null
/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17358
                        throw error;
                        ^

TypeError: Cannot read property 'getUniformLocation' of null
    at NodeCanvasElement.getContext (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/node-canvas-webgl/lib/canvas.js:88:39)
    at getContext (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17304:29)
    at new WebGLRenderer (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/three/build/three.js:17335:11)
    at module.exports (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/lib/headless.js:19:20)
    at EventEmitter.<anonymous> (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/examples/firstperson_bot.js:10:3)
    at Object.onceWrapper (events.js:481:28)
    at EventEmitter.emit (events.js:387:35)
    at Client.<anonymous> (/mnt/c/Users/forge/Documents/GitHub/prismarine-viewer/node_modules/mineflayer/lib/plugins/health.js:13:11)
    at Object.onceWrapper (events.js:482:26)
    at Client.emit (events.js:387:35)
[nodemon] app crashed - waiting for file changes before starting...
@KreizDev
Copy link

Same

@KreizDev
Copy link

I fixed this by using xvfb as desktop emulator

xvfb-run -e /dev/stdout -s "-ac -screen 0 800x600x30" python3 app.py

@Karang Karang closed this as completed Oct 3, 2021
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

3 participants