You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
node:internal/modules/cjs/loader:1112
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/fnordell/Documents/private/machine_learning/node_modules/@tangramxyz/tangram/dist/node.js
require() of ES modules is not supported.
require() of /Users/fnordell/Documents/private/machine_learning/node_modules/@tangramxyz/tangram/dist/node.js from /Users/fnordell/Documents/private/machine_learning/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename node.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/fnordell/Documents/private/machine_learning/node_modules/@tangramxyz/tangram/package.json.
at new NodeError (node:internal/errors:363:5)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:13)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (/Users/fnordell/Documents/private/machine_learning/index.js:3:17)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32) {
code: 'ERR_REQUIRE_ESM'
}
The text was updated successfully, but these errors were encountered:
In version 0.5.1, we did not support commonjs modules but forgot to update the documentation on the website to reflect that. We just published a new version (0.5.3) that now supports commonjs modules in addition to ES modules by using the exports key in package.json. If you update to the latest version of @tangramxyz/tangram (0.5.3) everything should work as shown in the documentation. We also added examples in languages/javascript/examples/node in this repo demonstrating the use of both commonjs and ES modules. The example in the docs has also been updated with a small change on line 9: the .buffer field needs to be used from the result of readFileSync. Please incorporate that into your code. Let us know if you run into more problems.
There seems to be an error on the Node example (https://www.tangram.xyz/docs/getting_started/predict/node).
Reproduce:
Node-version 16.4.2
The text was updated successfully, but these errors were encountered: