After typing the commands in the terminal (mac): npm init
and npm install nem-sdk
I create a main.js script in the same file:
let nem = require("nem-sdk").default;
let endpoint = nem.model.objects.create("endpoint")
(nem.model.nodes.defaultTesnet, nem.model.nodes.defaultPort);
nem.com.requests.chain.lastBlock(endpoint).then(function(block) {
console.log(block);
}, function(err){
console.log(err);
});
when I launched this file I got the following error msg: