import chessjs in node application

Viewed 152

Am quite new to nodejs, so this could be a silly question, but I hope not.

Am trying to import the chessjs library in a simple node app.

I have this :

const Chess = require('chessjs');
var chess = new Chess();

But I get :

Error: Cannot find module './chess.js'

when I run it despite having installed the lib with npm.

thanks

=========== EDIT SOLUTION ====================

const { Chess } = require('./node_modules/chess.js/chess.js')

1 Answers
Related