Skip to content

Error: Cannot find module 'common-tags', '@babel/generator' #1070

@elliottsj

Description

@elliottsj

Similar to #1068, the same problem occurs for 'common-tags' and '@babel/generator':

> apollo client:codegen --config=./apollo.config.js --target=typescript --outputFlat ./graphql-types.ts "--watch"

Error: Cannot find module 'common-tags'
    at Object.<anonymous> (~/Dev/Yolk-HQ/yolkjs/common/temp/node_modules/.registry.npmjs.org/apollo-codegen-flow/0.32.6/node_modules/apollo-codegen-flow/lib/codeGeneration.js:4:23)
> apollo client:codegen --config=./apollo.config.js --target=typescript --outputFlat ./graphql-types.ts "--watch"

Error: Cannot find module '@babel/generator'
    at Object.<anonymous> (~/Dev/Yolk-HQ/yolkjs/common/temp/node_modules/.registry.npmjs.org/apollo-codegen-flow/0.32.6/node_modules/apollo-codegen-flow/lib/printer.js:3:21)

Intended outcome:

No fatal error when launching the Apollo CLI.

Actual outcome:

See above.

How to reproduce the issue:

$ npm install --global pnpm
$ pnpm install apollo strip-ansi  # strip-ansi to avoid https://github.com/oclif/plugin-help/issues/31
$ ./node_modules/.bin/apollo client:codegen
Error: Cannot find module 'common-tags'
    at Object.<anonymous> (~/Dev/elliottsj/apollo-tooling-test/node_modules/.registry.npmjs.org/apollo-codegen-flow/0.32.8/node_modules/apollo-codegen-flow/lib/codeGeneration.js:4:23)
$ pnpm install common-tags
$ ./node_modules/.bin/apollo client:codegen
Error: Cannot find module '@babel/generator'
    at Object.<anonymous> (~/Dev/elliottsj/apollo-tooling-test/node_modules/.registry.npmjs.org/apollo-codegen-flow/0.32.8/node_modules/apollo-codegen-flow/lib/printer.js:3:21)

$ pnpm install @babel/generator
# This is another separate issue with listr; fix pending: https://github.com/SamVerschueren/listr/pull/127
Error: Cannot find any-observable implementation nor global.Observable. You must install polyfill or call require("any-observable/register") with your preferred implementation, e.g. require("any-observable/register")('rxjs') on application load prior to any require("any-observable").
    at loadImplementation (~/Dev/elliottsj/apollo-tooling-test/node_modules/.registry.npmjs.org/any-observable/0.3.0/node_modules/any-observable/register.js:29:9)
    at ~/Dev/elliottsj/apollo-tooling-test/node_modules/.registry.npmjs.org/any-observable/0.3.0/node_modules/any-observable/loader.js:30:18
    at Object.<anonymous> (~/Dev/elliottsj/apollo-tooling-test/node_modules/.registry.npmjs.org/any-observable/0.3.0/node_modules/any-observable/index.js:2:39)

$ pnpm install rxjs
$ ./node_modules/.bin/apollo client:codegen
# This is another separate issue; fix here: https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/pull/7
Error: Cannot find module 'make-error'
    at Object.<anonymous> (~/Dev/elliottsj/apollo-tooling-test/node_modules/.registry.npmjs.org/@endemolshinegroup/cosmiconfig-typescript-loader/1.0.0/cosmiconfig@5.1.0/node_modules/@endemolshinegroup/cosmiconfig-typescript-loader/dist/Errors/TypeScriptCompileError.js:3:22)

$ pnpm install make-error
$ ./node_modules/.bin/apollo client:codegen
 ›   Error: Missing required flag:
 ›     --target TARGET  Type of code generator to use (swift | typescript | flow | scala)
 ›   See more help with --help

# success!

Versions

$ npm -v
6.8.0
$ pnpm -v
2.25.6
$ node -v
v10.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions