mathml2latex icon indicating copy to clipboard operation
mathml2latex copied to clipboard

Cannot build application on Mac (M1) - Ventura

Open Maddocent opened this issue 3 years ago • 0 comments

I am running command

npm run build 

But encountering the following error:

> [email protected] build
> npm run build-cjs && npm run build-es && npm run build-umd && npm run build-iife .


> [email protected] build-cjs
> rollup -c config/rollup.config.cjs.js && rollup -c config/rollup.config.browser.cjs.js

(node:4725) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
[!] RollupError: Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag.

Original error: Cannot use import statement outside a module
https://rollupjs.org/guide/en/#--bundleconfigascjs
/Users/marcteunis/Documents/workspaces/mathml2latex/config/rollup.config.cjs.js:1
import config from './rollup.config'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:74:18)
    at wrapSafe (node:internal/modules/cjs/loader:1141:20)
    at Module._compile (node:internal/modules/cjs/loader:1182:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:167:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

I am new to javascript. I tried putting the flag "--bundleConfigAsCjs` as:

npm run build --bundleConfigAsCjs, but no luck. The error persists.

I installed node via Homebrew. The Homebrew PATH is on my system and that installation worked.

Any pointers to a possible solution is much appreciated.

Thanks for your considerations,

Maddocent avatar Dec 21 '22 10:12 Maddocent