Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh install fail on Mac: Cannot find module 'core-js/proposals/array-flat-and-flat-map' #2263

Closed
ulucaydin opened this issue Feb 2, 2019 · 16 comments

Comments

@ulucaydin
Copy link

ulucaydin commented Feb 2, 2019

A fresh install fails as follows after including const { ApolloServer, gql } = require('apollo-server');:

nodemon server.js
[nodemon] 1.18.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'core-js/proposals/array-flat-and-flat-map'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/ulucaydin/repos/myproject/backend/node_modules/apollo-env/lib/polyfills/array.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
[nodemon] app crashed - waiting for file changes before starting...

Here is my package.json:

{
  "name": "backend",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@babel/polyfill": "^7.2.5",
    "babel": "^6.23.0",
    "core-js": "^2.6.3",
    "mongodb": "^3.1.13"
  },
  "devDependencies": {
    "apollo-server": "^2.3.3",
    "apollo-server-express": "^2.3.3",
    "express": "^4.16.4",
    "graphql": "^14.1.1",
    "install": "^0.12.2",
    "mongoose": "^5.4.9",
    "node-zillow": "^2.0.0",
    "nodemon": "^1.18.9",
    "npm": "^6.7.0"
  }
}
@Kivol
Copy link

Kivol commented Feb 2, 2019

I was experiencing the exact same problem here. I temporarily fixed it by setting "core-js": "3.0.0-beta.11" on package.json.

@franquis
Copy link

franquis commented Feb 2, 2019

Related to apollographql/apollo-tooling#962

@tomfinney
Copy link

I was experiencing the exact same problem here. I temporarily fixed it by setting "core-js": "3.0.0-beta.11" on package.json.

thanks for that! my workaround was to downgrade my apollo-server version. 😬

@zainulabidin302
Copy link

zainulabidin302 commented Feb 2, 2019

"dependencies": {
"apollo-server-express": "^2.3.3",
"arangojs": "^5.8.0",
"babel-loader": "^8.0.5",
"babel-polyfill": "^6.26.0",
"body-parser": "^1.18.3",
"core-js": "3.0.0-beta.11",
"express": "^4.16.4",
"firebase-admin": "^6.5.0",
"graphql": "^14.0.2",
"graphql-tools": "^4.0.3",
"request": "^2.88.0"
},

Not sure why the workaround is not working for me.
I am on mac.

@Kelbie
Copy link

Kelbie commented Feb 2, 2019

I'm so relieved I'm not the only one having this issue.

I'm not sure if this helps but I'm on a Mac using express and apollo-server-express/apollo-server throws the same error OP has.

@zainulabidin302
Copy link

finally copied core-js "core-js": "3.0.0-beta.11" to
cp -rf node_modules/core-js /usr/local/lib/node_modules/apollo/node_modules/
phew that's not a good solution but it works for me.

@kassiomaia
Copy link

The last night I spent some hours investigating this and I was able to solve by installing this version [email protected] and [email protected].

@robhicks
Copy link

robhicks commented Feb 2, 2019

I have had apollo-server-express (2.3.1) deployed for months on heroku running against express 4.16.4. As of this morning I cannot restart the server successfully because of this error.

I have tried all of the workaround suggested above. Nothing has worked.

@guyellis
Copy link

guyellis commented Feb 2, 2019

I'm hitting this as well inasmuch as a previously working installation is now no longer working after a new npm install. I'm guessing that there's an optimistic dependency in the chain that's been upgraded that's missing a reference to this module as its dependency. <== In case anybody is investigating this.

BTW - for me this is happening on Ubuntu 14.x and 18.x so it's not just related to Macs.

@wworrall
Copy link

wworrall commented Feb 2, 2019

Experiencing same issue - not able to redeploy my dockerised production app - using node / debian stretch base container. I have tried workaround changing "apollo-server-express": "^2.3.3" but to no avail.

@ayhamthemayhem
Copy link

I also had the same problem by just setting up a simple server like in the docs with no extra code

@Gn0ume
Copy link

Gn0ume commented Feb 2, 2019

For hour a solution is installing the "core-js": "3.0.0-beta.3" in application, but it is not recommended.

It may be any version between 3 and 11, issue is known since 12

@shalkam
Copy link

shalkam commented Feb 2, 2019

I've installed [email protected] still didn't work for me.
I had to added this to package.json to force this version to be used

  "resolutions": {
    "core-js": "3.0.0-beta.11"
  }

And it worked just fine.

It's a yarn feature https://yarnpkg.com/lang/en/docs/selective-version-resolutions/ , I don't know if it would work with npm.

@BrenoMazieiro
Copy link

Thanks @shalkam! This wa worked just fine!

@abernix
Copy link
Member

abernix commented Feb 4, 2019

Thank you to all those that reported this and supplied the appropriate work-arounds. This should have been fixed by apollo-tooling's apollographql/apollo-tooling#961 and I'm unable to reproduce the problem this morning.

There were no changes to apollo-server necessary to fix it.

If anyone is still experiencing this problem, please do report back!

@stevez86
Copy link

@abernix I'm experience this issue. My comment here: apollographql/apollo-tooling#962 (comment) and my issue here: apollographql/apollo-tooling#1481

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests