MichalLytek / type-graphql

Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
https://typegraphql.com
MIT License
8.03k stars 676 forks source link

wont open on OSX. #664

Closed galois-dev closed 4 years ago

galois-dev commented 4 years ago

Describe the Bug A clear and concise description of what the bug is. I get an error telling me to polyfill my fucking server because something in this pacakage wont run with es5-6 and it requires es5-6. I run no business logic, no code literally just importing this breaks my server. Everything else runs fine.

To Reproduce A quick guide how to reproduce the bug. You can paste here code snippets or even better, provide a link to the repository with minimal reproducible code example.

Import the package

Expected Behavior A clear and concise description of what you expected to happen.

Nothing, no code is run its just fucking bricked from import

Logs If applicable, add some console logs to help explain your problem. You can paste the errors with stack trace that were printed when the error occured.

[INFO] 15:53:29 Restarting: /Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/src/main.ts has been modified Error: Looks like you've forgot to provide experimental metadata API polyfill. Please read the installation instruction for more details. at Object.ensureReflectMetadataExists (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/metadata/utils.js:41:15) at new MetadataStorage (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/metadata/metadata-storage.js:26:17) at Object.getMetadataStorage (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/metadata/getMetadataStorage.js:5:87) at Resolver.target (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/decorators/Resolver.js:19:30) at __decorate (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/src/domain/user/user.resolver.ts:5:95) at /Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/src/domain/user/user.resolver.ts:10:26 at Object. (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/src/domain/user/user.resolver.ts:10:1) at Module._compile (internal/modules/cjs/loader.js:734:30) at Module._compile (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/source-map-support/source-map-support.js:547:25) at Module.m._compile (/private/var/folders/g_/k1bttrxs3hd5h7py17b7wt7r0000gn/T/ts-node-dev-hook-39679732610653184.js:59:25) at Module._extensions..js (internal/modules/cjs/loader.js:745:10) at require.extensions.(anonymous function) (/private/var/folders/g_/k1bttrxs3hd5h7py17b7wt7r0000gn/T/ts-node-dev-hook-39679732610653184.js:61:14) at Object.nodeDevHook [as .ts] (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/ts-node-dev/lib/hook.js:61:7) at Module.load (internal/modules/cjs/loader.js:626:32) at tryModuleLoad (internal/modules/cjs/loader.js:566:12) at Function.Module._load (internal/modules/cjs/loader.js:558:3) Using ts-node version 8.10.2, typescript version 3.9.5 Error: Looks like you've forgot to provide experimental metadata API polyfill. Please read the installation instruction for more details. at Object.ensureReflectMetadataExists (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/metadata/utils.js:41:15) at new MetadataStorage (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/metadata/metadata-storage.js:26:17) at Object.getMetadataStorage (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/metadata/getMetadataStorage.js:5:87) at Resolver.target (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/type-graphql/dist/decorators/Resolver.js:19:30) at __decorate (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/src/domain/user/user.resolver.ts:5:95) at /Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/src/domain/user/user.resolver.ts:10:26 at Object. (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/src/domain/user/user.resolver.ts:10:1) at Module._compile (internal/modules/cjs/loader.js:734:30) at Module._compile (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/source-map-support/source-map-support.js:547:25) at Module.m._compile (/private/var/folders/g_/k1bttrxs3hd5h7py17b7wt7r0000gn/T/ts-node-dev-hook-39679732610653184.js:59:25) at Module._extensions..js (internal/modules/cjs/loader.js:745:10) at require.extensions.(anonymous function) (/private/var/folders/g_/k1bttrxs3hd5h7py17b7wt7r0000gn/T/ts-node-dev-hook-39679732610653184.js:61:14) at Object.nodeDevHook [as .ts] (/Users/benjamin/PycharmProjects/VscodeProjects/dinasite/backend/node_modules/ts-node-dev/lib/hook.js:61:7) at Module.load (internal/modules/cjs/loader.js:626:32) at tryModuleLoad (internal/modules/cjs/loader.js:566:12) at Function.Module._load (internal/modules/cjs/loader.js:558:3) [ERROR] 15:53:33 Error: Looks like you've forgot to provide experimental metadata API polyfill. Please read the installation instruction for more details.

Environment (please complete the following information):

Additional Context Add any other context about the problem here.

MichalLytek commented 4 years ago

I get an error telling me to polyfill my fucking server because something in this pacakage wont run with es5-6 and it requires es5-6.

You need to install fucking reflect-metadata package as described in the fucking installation docs: https://typegraphql.com/docs/installation.html

This shit also describes that you need to configure your TS to es2018 and run on the Node.js LTS (10.3+, 12+) that supports this es target.

galois-dev commented 4 years ago

works like fucking described

adventurini commented 3 years ago

Just a note:

If you are running into issues with tsc and trying to run a script, import 'reflect-metadata' directly into the fucking script file.

mgonzalezg9 commented 2 years ago

Another comment on this: place this import on top to avoid other reflection issues 😬

Just a note:

If you are running into issues with tsc and trying to run a script, import 'reflect-metadata' directly into the fucking script file.

eglove commented 2 years ago

Why isn't this fucking shit on the Prisma site? https://prisma.typegraphql.com/docs/basics/installation

MichalLytek commented 2 years ago

@eglove You need to read this fucking docs properly to make this fucking shit working well: image

eglove commented 2 years ago

Well, fuck me for not reading. Thank you.

atomicpages commented 2 years ago

For people passing the fuck by trying to get jest to behave you need to do some additional shit. First, create a setup file with this:

import 'reflect-metadata';

and then fucking update your jest config:

const config = {
  setupFilesAfterEnv: ["<rootDir>/jest-setup.js"],
};

export default config;

You can now test your shit

BlueBazze commented 2 years ago

Sorry for necro, but this just made my fucking day

alacret commented 2 years ago

LOL F@cking Thread!

galois-dev commented 2 years ago

Let this thread be a cautionary tale. Two years later and this ragepost is still farming the lolz at my expense.

novikesumaningtyas commented 2 years ago

Oh my god, this is the first time ever I found such a heart-warming thread, thanks guys for making my day! 2 years later and still the same issue with fucking typegraphql. Error only there when I tried to do jest test, it is working fine in the local run. Solved by import reflect-metadata at the top of files where I registered the enum.

kicks321 commented 1 year ago

I get an error telling me to polyfill my fucking server because something in this pacakage wont run with es5-6 and it requires es5-6.

You need to install fucking reflect-metadata package as described in the fucking installation docs: https://typegraphql.com/docs/installation.html

This shit also describes that you need to configure your TS to es2018 and run on the Node.js LTS (10.3+, 12+) that supports this es target.

I mean the docs don't fucking say you need it for JEST testing tho 😉

shellscape commented 1 year ago

This is the funniest fucking issue thread I've ever come across.

jandve commented 1 year ago

best fucking post ever

KingCh1ll commented 1 year ago

most normal software engineer discussion

shubhxg commented 2 months ago

very interesting discussion

oyepriyansh commented 2 months ago

here for fun

shashankbhat2 commented 2 months ago

Spicy thread

jaiakash commented 2 months ago

here for fun, from twitter