Cannot find module ts-node
marticrespi opened this issue · 4 comments
Description
When I execute graphqlgen
doesn't work, it tells me that ts-node
is missing from graphqlgen/dist/parse.js
Steps to reproduce
Only I have installed it with these dev dependencies..
"@types/aws-lambda": "8.10.19",
"@types/graphql": "14.0.7",
"@types/ws": "6.0.1",
"cross-env": "^5.2.0",
"graphqlgen": "^0.6.0-rc8",
"prisma": "^1.26.6",
"ts-node": "8.0.2",
"typescript": "3.3.3"
Expected results
Generate the code successfully.
Actual results
$ graphqlgen
module.js:540
throw err;
^
Error: Cannot find module 'ts-node'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\XXXXXXX\AppData\Roaming\npm\node_modules\graphqlgen\dist\parse.js:19:14)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
Versions
It's strange, throw same error when I want to know my installed version. But it's the last version, 0.6.0-rc8.
$ graphqlgen --version
module.js:540
throw err;
^
Error: Cannot find module 'ts-node'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\XXXXX\AppData\Roaming\npm\node_modules\graphqlgen\dist\parse.js:19:14)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
- OS name and version: Windows 10
issue here 19f5bce#diff-aeb8c724fbf89c652a9b9d6531803566R6
possible solutions:
- move ts-node from dev-dep to dep
- move ts-node from dev-dep to optional-dependencies; then use dynamic import (
require
) and raise manual error ifts-node
not found (tell user that they need to install ts-node to use schemas in ts files)
Option 1 increases install time and dep tree complexity for all while Option 2 only does so for users using the schema-in-ts-file feature. But Option 2 requires more effort from users that are using the schema-in-ts-file while option 1 would Just Work.
From what I see at http://npm.anvaka.com/#/view/2d/ts-node option 1 seems fine.
Hi 👋 @marticrespi, thanks for reporting. Will fix this tonight.
Hi @jasonkuhrt I have updated to rc9 and before, I have deleted all node_modules
folder and it throws the same error. :(
@marticrespi sorry to hear that! I will see if I can repro on one of my projects.