stockfish.js:18 Uncaught ReferenceError: SharedArrayBuffer is not defined
I'm getting an error in my console log
Uncaught ReferenceError: SharedArrayBuffer is not defined
at stockfish.js:18
at stockfish.js:237
at INIT_ENGINE (stockfish.js:258)
at stockfish.js:269
This is likely due to https://web.dev/cross-origin-isolation-guide/
I'm getting an error in my console log
Uncaught ReferenceError: SharedArrayBuffer is not defined at stockfish.js:18 at stockfish.js:237 at INIT_ENGINE (stockfish.js:258) at stockfish.js:269
Did you ever find a solution for this?
So I was running it through XAMPP and added these lines to the XAMPP config file
Header set Cross-Origin-Embedder-Policy "require-corp" Header set Cross-Origin-Opener-Policy "same-origin"
That seemed to solve the sharedBufferArray error
You can try using an older version like 11.0.0
If you are using a locaclhost webpage for this you can put this into a file i called server.js and change foldername-of-websitestuff to the foldername where your files of your website are located and change web.html to the html file of your website, then you can run "node server.js" to run a localhost server where you will not get the error sharedarraybuffer is not definde`const express = require('express'); const path = require('path');
const app = express(); const publicFolderPath = path.join(__dirname, 'foldername-of-websitestuff');
app.use((req, res, next) => { res.set('Cross-Origin-Embedder-Policy', 'require-corp'); res.set('Cross-Origin-Opener-Policy', 'same-origin'); next(); });
app.use(express.static(publicFolderPath));
app.get('/', (req, res) => { res.sendFile(path.join(publicFolderPath, 'web.html')); });
// ... Rest of your server code
app.listen(3000, () => { console.log('Server is running on port 3000'); }); `
The downloaded code contains an example that doesn't work in the web browser on the localhost of a Windows computer. You'll get these SharedArrayBuffer errors. Can someone tell if it works on a Mac? (Or does it only work with node.js?)