Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Cannot find module ts-node #455

Open
marticrespi opened this issue Feb 18, 2019 · 4 comments
Open

Cannot find module ts-node #455

marticrespi opened this issue Feb 18, 2019 · 4 comments
Labels
area/cli bug/1-repro-available A reproduction exists and needs to be confirmed. kind/bug
Milestone

Comments

@marticrespi
Copy link

marticrespi commented Feb 18, 2019

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
@marticrespi marticrespi changed the title Cannot finde module ts-node Cannot find module ts-node Feb 18, 2019
@jasonkuhrt
Copy link
Member

issue here 19f5bce#diff-aeb8c724fbf89c652a9b9d6531803566R6

possible solutions:

  1. move ts-node from dev-dep to dep
  2. move ts-node from dev-dep to optional-dependencies; then use dynamic import (require) and raise manual error if ts-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.

@jasonkuhrt
Copy link
Member

Hi 👋 @marticrespi, thanks for reporting. Will fix this tonight.

@jasonkuhrt jasonkuhrt added this to the 0.6.0 milestone Feb 18, 2019
@marticrespi
Copy link
Author

Hi @jasonkuhrt I have updated to rc9 and before, I have deleted all node_modules folder and it throws the same error. :(

@jasonkuhrt
Copy link
Member

@marticrespi sorry to hear that! I will see if I can repro on one of my projects.

@jasonkuhrt jasonkuhrt reopened this Feb 20, 2019
@jasonkuhrt jasonkuhrt added bug/1-repro-available A reproduction exists and needs to be confirmed. and removed bug/2-confirmed labels Feb 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/cli bug/1-repro-available A reproduction exists and needs to be confirmed. kind/bug
Projects
None yet
Development

No branches or pull requests

3 participants