idyll-lang / idyll

Create explorable explanations and interactive essays.
http://idyll-lang.org/
MIT License
2.01k stars 87 forks source link

Idyll does not build (Node 16 issue?) #752

Closed vilim closed 3 years ago

vilim commented 3 years ago

Describe the bug Compiling a new project fails with error

.../my-idyll-post/node_modules/scrollmonitor/dist/index.js:1
export { ScrollMonitorContainer } from './src/container.js';
^^^^^^

SyntaxError: Unexpected token 'export'

I got Idyll to run once, but I think the node.js version was different then (12.x)

To Reproduce Steps to reproduce the behavior:

  1. Follow install and new project instructions from the idyll docs
  2. run the idyll command in the newly-created project the build error occurs

Desktop (please complete the following information):

Additional context Full error message:

.../my-idyll-post/node_modules/scrollmonitor/dist/index.js:1
export { ScrollMonitorContainer } from './src/container.js';
^^^^^^

SyntaxError: Unexpected token 'export'
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .js] (.../interactive/my-idyll-post/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.Module._load (.../my-idyll-post/node_modules/idyll/src/node-config.js:23:29)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (.../my-idyll-post/node_modules/idyll-document/dist/cjs/runtime.js:19:22)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .js] (..//my-idyll-post/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
mathisonian commented 3 years ago

@vilim thanks for reporting this - I am able to reproduce this locally and can confirm its a bug. It affects at least node v14 as well, so it may not be a node version issue. I'm going to dig into this and will update with possible fixes / workarounds as I learn more.

mathisonian commented 3 years ago

This seems to be an issue with scrollmonitor@1.2.7 specifically. Here's a workaround until I can get a patch released:

$ idyll create
...
$ cd my-new-post
$ npm i --save scrollmonitor@1.2.6
$ idyll

Basically just pin scrollmonitor to the older release and everything should build fine

vilim commented 3 years ago

Thank you!

mathisonian commented 3 years ago

No problem! This should be fixed in the latest release of Idyll (idyll@5.7.3 just released on npm) with no workaround needed. Feel free to re-open if you continue to have issues.