Graphql-yoga: Cannot find module 'graphql-yoga'

Created on 28 Apr 2018  路  10Comments  路  Source: dotansimha/graphql-yoga

Steps to reproduce:

  1. mkdir playground
  2. cd playground
  3. yarn init -y
  4. yarn add graphql-yoga
  5. node
  6. require('graphql-yoga')
Error: Cannot find module 'graphql-yoga'
    at Function.Module._resolveFilename (module.js:543:15)
    at Function.Module._load (module.js:470:25)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)

Node v9.10.1
Yarn v1.6.0

Most helpful comment

I think it's best to stick with [email protected] for now. Any tweaks in package.json in node_modules/graphql-yoga will be washed away after running yarn or npm install.

All 10 comments

This can be true 馃槰

Yoga's package.json mentions "main": "dist/src/index.js", while the tree in node_modules looks like so:

screen shot 2018-04-28 at 17 37 51

Most probable cause is this change in #283.

@KATT @schickling 馃啒

@kurniawanw0194 does installing [email protected] solve the issue for you? This may work as a temporary workaround, you just won't get graphql-deduplicator introduced earlier today via https://github.com/graphcool/graphql-yoga/pull/272.

I believe @kachkaev meant [email protected]? This is the latest version that I could get to work this morning. Also manually changing the package.json main field from "main": "dist/src/index.js" to "main": "dist/index.js" solved the problem with the latest graphql-yoga but I'm not sure if that would break other things?

Same issue.

I think it's best to stick with [email protected] for now. Any tweaks in package.json in node_modules/graphql-yoga will be washed away after running yarn or npm install.

Yup sticking with 1.12.1 till this gets patched! 馃槃

Apologies for the inconvenience. This one must have slipped while merging this PR: https://github.com/graphcool/graphql-yoga/pull/283

I just released a new fix 馃殺

I did that because typescript watcher doesn't like to both watch dist and write to dist. Wasn't aware it would affect anything other than typescript compilation. Now you probably broke yarn watch instead, but I haven't confirmed (on my phone writing this).

@KATT I see. Happy to merge a PR that fixes this 馃槉

@schickling I got a PR open now - #300 - please CR carefully :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joshhopkins picture joshhopkins  路  3Comments

ramonmulia picture ramonmulia  路  3Comments

bellomusodiq picture bellomusodiq  路  3Comments

2wce picture 2wce  路  4Comments

asci picture asci  路  3Comments