-
Notifications
You must be signed in to change notification settings - Fork 583
Closed
Description
Describe the bug
The Express example is not starting after a fresh install:
$ pnpm install && pnpm build
...
$ cd examples/express && pnpm start
> example-express@0.13.6 start /Users/valentin/Dev/Projects/graphql-yoga/examples/express
> ts-node src/index.ts
/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:851
return old(m, filename);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js from /Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/@graphql-tools+utils@9.2.1_graphql@16.6.0/node_modules/@graphql-tools/utils/cjs/index.js not supported.
tslib.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename tslib.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at require.extensions.<computed> [as .js] (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:851:20)
at Object.<anonymous> (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/@graphql-tools+utils@9.2.1_graphql@16.6.0/node_modules/@graphql-tools/utils/cjs/index.js:3:17)
at require.extensions.<computed> [as .js] (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:851:20)
at Object.<anonymous> (/Users/valentin/Dev/Projects/graphql-yoga/packages/graphql-yoga/dist/cjs/error.js:5:17)
at require.extensions.<computed> [as .js] (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:851:20)
at Object.<anonymous> (/Users/valentin/Dev/Projects/graphql-yoga/packages/graphql-yoga/dist/cjs/index.js:5:18)
at require.extensions.<computed> [as .js] (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:851:20)
at Object.<anonymous> (/Users/valentin/Dev/Projects/graphql-yoga/examples/express/src/app.ts:4:24)
at m._compile (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:857:29)
at require.extensions.<computed> [as .ts] (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:859:16)
at Object.<anonymous> (/Users/valentin/Dev/Projects/graphql-yoga/examples/express/src/index.ts:7:15)
at m._compile (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:857:29)
at require.extensions.<computed> [as .ts] (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/index.js:859:16)
at phase4 (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/bin.js:466:20)
at bootstrap (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/bin.js:54:12)
at main (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/bin.js:33:12)
at Object.<anonymous> (/Users/valentin/Dev/Projects/graphql-yoga/node_modules/.pnpm/ts-node@10.9.1/node_modules/ts-node/dist/bin.js:579:5) {
code: 'ERR_REQUIRE_ESM'
}
ELIFECYCLE Command failed with exit code 1.
Your Example Website or App
https://github.com/dotansimha/graphql-yoga/tree/main/examples/express
Steps to Reproduce the Bug or Issue
- Clone the project
- run
pnpm install - run
pnpm build - go to
examples/express - run
pnpm start
Expected behavior
It should start the express server example.
Screenshots or Videos
No response
Platform
- OS: macOS 13.3.1
- NodeJS: v20.0.0
@graphql-yoga/*version(s): master
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels