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
Today I updated to the latest release from a significantly older version, and now running the cli script is failing:
> wtf_wikipedia https://en.wikipedia.org/wiki/Kaja_Kallas
file:///usr/local/lib/node_modules/wtf_wikipedia/cli.js:2
const wtf = require('./src/index')
^
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/usr/local/lib/node_modules/wtf_wikipedia/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///usr/local/lib/node_modules/wtf_wikipedia/cli.js:2:13
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Node.js v19.2.0
It's possible that something has gone awry in my local environment, but from some brief googling, it looks like Node 14 changed the behaviour of require if package.json declares type: module. So I think that either that should be changed totype: commonjs, or the import mechanism in cli.js should be changed, but I'm a little out of my depth here.
The text was updated successfully, but these errors were encountered:
Today I updated to the latest release from a significantly older version, and now running the cli script is failing:
It's possible that something has gone awry in my local environment, but from some brief googling, it looks like Node 14 changed the behaviour of
require
if package.json declarestype: module
. So I think that either that should be changed totype: commonjs
, or the import mechanism incli.js
should be changed, but I'm a little out of my depth here.The text was updated successfully, but these errors were encountered: