nareshbhatia / graphql-bookstore

Example demonstrating the use of GraphQL to implement a rich domain with multiple entities and relationships
120 stars 19 forks source link

Cannot find module 'core-js/proposals/array-flat-and-flat-map' #7

Open robross0606 opened 5 years ago

robross0606 commented 5 years ago

Getting an error when running yarn dev on Step 2 of your blog instructions:

yarn run v1.17.3
$ nodemon --watch src -e ts,graphql --exec yarn start
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: C:\Code\learning\graphql\graphql-bookstore\apollo-bookstore-server\src/**/*
[nodemon] starting `yarn start`
$ ts-node.cmd src/index.ts
Error: Cannot find module 'core-js/proposals/array-flat-and-flat-map'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (...\graphql-bookstore\apollo-bookstore-server\node_modules\apollo-env\src\polyfills\array.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[nodemon] app crashed - waiting for file changes before starting...
robross0606 commented 5 years ago

Related to this? https://github.com/apollographql/apollo-server/issues/2263

robross0606 commented 5 years ago

I can confirm this is only happening on Windows. Tried on Ubuntu and OSX and both seemed to work fine.

nareshbhatia commented 5 years ago

Have you tried the latest code in the master branch? I had updated dependencies last week - maybe this issue is fixed for windows. Also I was able to make the production build working (without ts-node). Perhaps you can try that.

robross0606 commented 5 years ago

Yes, this appears to have been resolved in master. Unfortunately, all your tags for the various steps in your instructions are still broken.

robross0606 commented 5 years ago

Also, you should use npx in your package.json scripts so these things run on all platforms:

  "scripts": {
    "prebuild": "npx rimraf dist",
    "build": "tsc && yarn copy-to-dist",
    "copy-to-dist": "npx copyfiles --up 1 src/graphql/typedefs/* dist",
    "dev": "npx nodemon --watch src -e ts,graphql --exec yarn start:dev",
    "format": "npx prettier --write README.md 'src/**/*.ts'",
    "start": "node dist/index.js",
    "start:debug": "npx ndb ts-node src/index.ts",
    "start:dev": "npx ts-node src/index.ts"
  }
nareshbhatia commented 5 years ago

Thanks for the great suggestions @robross0606. Unfortunately I can't change content of committed tags. Time permitting, I would like to completely rewrite the article with latest versions of React and Apollo, utilizing function components and hooks.

robross0606 commented 5 years ago

@nareshbhatia, understood. Could you update the article(s) to suggest people just use the master branch instead of checking out the tags? Or, at least, add a link to a supplement that suggests how people can fix the tags to make them actually run. Or perhaps update the readme.md with hints as to how to fix if it won't run?

nareshbhatia commented 5 years ago

Yep. I think the easiest would be to update the README and add a note to the article to always check the README in the master branch. If you could send me a PR on the README that would be a big help.

robross0606 commented 5 years ago

The problem with just updating the README is that the change would not be visible on the existing tags. What really needs to change is the BLOG article.