Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11ty] Problem writing Eleventy templates: (more in DEBUG output) #94

Open
cooljeanius opened this issue Nov 14, 2023 · 2 comments
Open
Labels
education triage Unknown classification

Comments

@cooljeanius
Copy link

Running npm run start or npm run build used to work for me previously. Now they both fail with:

$ npm run start
npm WARN cli npm v9.9.1 does not support Node.js v15.14.0. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.

> @tweetback/tweetback@1.0.0 start
> npx @11ty/eleventy --quiet --serve

npm WARN cli npm v9.9.1 does not support Node.js v15.14.0. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || >=18.0.0`. You can find the latest version at https://nodejs.org/.
[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] Must use import to load ES Module: /Users/ericgallager/Documents/GitHub/tweetback/node_modules/parse-domain/build/main.js
[11ty] require() of ES modules is not supported.
[11ty] require() of /Users/ericgallager/Documents/GitHub/tweetback/node_modules/parse-domain/build/main.js from /Users/ericgallager/Documents/GitHub/tweetback/src/twitter.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.
[11ty] Instead rename main.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ericgallager/Documents/GitHub/tweetback/node_modules/parse-domain/package.json. (via Error)
[11ty] 
[11ty] Original error stack trace: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/ericgallager/Documents/GitHub/tweetback/node_modules/parse-domain/build/main.js
[11ty] require() of ES modules is not supported.
[11ty] require() of /Users/ericgallager/Documents/GitHub/tweetback/node_modules/parse-domain/build/main.js from /Users/ericgallager/Documents/GitHub/tweetback/src/twitter.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.
[11ty] Instead rename main.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/ericgallager/Documents/GitHub/tweetback/node_modules/parse-domain/package.json.
[11ty] 
[11ty]     at new NodeError (node:internal/errors:329:5)
[11ty]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1109:13)
[11ty]     at Module.load (node:internal/modules/cjs/loader:972:32)
[11ty]     at Function.Module._load (node:internal/modules/cjs/loader:813:14)
[11ty]     at Module.require (node:internal/modules/cjs/loader:996:19)
[11ty]     at require (node:internal/modules/cjs/helpers:92:18)
[11ty]     at Object.<anonymous> (/Users/ericgallager/Documents/GitHub/tweetback/src/twitter.js:2:25)
[11ty]     at Module._compile (node:internal/modules/cjs/loader:1092:14)
[11ty]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
[11ty]     at Module.load (node:internal/modules/cjs/loader:972:32)
[11ty] Wrote 0 files in 0.11 seconds (v2.0.1)

I tried turning on the DEBUG output, but it's really rather long; do you want the whole thing anyways?

@zachleat
Copy link
Contributor

zachleat commented Dec 5, 2023

parse-domain swapped to ESM in v6 but the version this project is using is v5

https://github.com/peerigon/parse-domain/blob/main/CHANGELOG.md#600-2022-01-23
https://github.com/tweetback/tweetback/blob/main/package.json

Not quite sure how you got an invalid package version installed but I’d reset your node_modules from scratch

@cooljeanius
Copy link
Author

parse-domain swapped to ESM in v6 but the version this project is using is v5

peerigon/parse-domain@main/CHANGELOG.md#600-2022-01-23 main/package.json

Not quite sure how you got an invalid package version installed

It's possible I might have run npm audit fix --force or something?

I’d reset your node_modules from scratch

OK, this seems to have worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
education triage Unknown classification
Projects
None yet
Development

No branches or pull requests

2 participants