Module not found: Can't resolve './graphql' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql' node_modules/graphql/index.mjs
See original GitHub issueDescribe the bug A clear and concise description of what the bug is.
I just installed was-amplify using npm install aws-amplify
, so to my mind this should work as per the instructions. I only want to use the authentication mechanism to make calls to a protected API.
Now, when I run my web pack dev server, I get the following error:
Module not found: Can't resolve './graphql' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
node_modules/graphql/index.mjs
The console error in my terminal is as follows:
webpack 5.12.3 compiled with 8 errors and 6 warnings in 438 ms
ℹ 「wdm」: Failed to compile.
ℹ 「wdm」: Compiling...
ℹ 「wdm」: assets by status 1.55 MiB [cached] 405 assets
assets by status 3.63 MiB [emitted]
assets by path *.js 3.63 MiB
asset bundle.js 3.62 MiB [emitted] (name: main)
asset main.fd44766afbb849381261.hot-update.js 7.18 KiB [emitted] [immutable] [hmr] (name: main)
asset index.html 315 bytes [emitted]
asset main.fd44766afbb849381261.hot-update.json 28 bytes [emitted] [immutable] [hmr]
Entrypoint main 3.63 MiB = bundle.js 3.62 MiB main.fd44766afbb849381261.hot-update.js 7.18 KiB
cached modules 12.2 MiB [cached] 2063 modules
runtime modules 30.2 KiB 16 modules
./src/components/Header.jsx 3.53 KiB [built] [code generated]
webpack 5.12.3 compiled successfully in 255 ms
ℹ 「wdm」: Compiled successfully.
ℹ 「wdm」: Compiling...
✖ 「wdm」: assets by status 1.55 MiB [cached] 405 assets
assets by status 3.63 MiB [emitted]
assets by path *.js 3.63 MiB
asset bundle.js 3.62 MiB [emitted] (name: main)
asset main.4b09da93748355d3eec3.hot-update.js 7.18 KiB [emitted] [immutable] [hmr] (name: main)
asset index.html 315 bytes [emitted]
asset main.4b09da93748355d3eec3.hot-update.json 28 bytes [emitted] [immutable] [hmr]
Entrypoint main 3.63 MiB = bundle.js 3.62 MiB main.4b09da93748355d3eec3.hot-update.js 7.18 KiB
cached modules 20.3 MiB [cached] 3114 modules
runtime modules 30.2 KiB 16 modules
./src/components/Header.jsx 3.57 KiB [built] [code generated]
WARNING in ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 221:41-53
export 'GraphQLError' (imported as 'GraphQLError') was not found in 'graphql' (possible exports: )
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
WARNING in ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 345:49-61
export 'GraphQLError' (imported as 'GraphQLError') was not found in 'graphql' (possible exports: )
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
WARNING in ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 503:37-49
export 'GraphQLError' (imported as 'GraphQLError') was not found in 'graphql' (possible exports: )
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
WARNING in ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 519:46-58
export 'GraphQLError' (imported as 'GraphQLError') was not found in 'graphql' (possible exports: )
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
WARNING in ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 543:37-49
export 'GraphQLError' (imported as 'GraphQLError') was not found in 'graphql' (possible exports: )
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
WARNING in ./node_modules/amazon-cognito-identity-js/es/utils/cryptoSecureRandomInt.js 20:13-30
Module not found: Error: Can't resolve 'crypto' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/amazon-cognito-identity-js/es/utils'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
@ ./node_modules/amazon-cognito-identity-js/es/utils/WordArray.js 1:0-60 43:17-38
@ ./node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js 23:0-42 26:25-34
@ ./node_modules/amazon-cognito-identity-js/es/index.js 18:0-73 18:0-73
@ ./node_modules/@aws-amplify/auth/lib-esm/index.js 15:0-99 21:0-122 21:0-122 21:0-122
@ ./node_modules/aws-amplify/lib-esm/index.js 14:0-41 19:15-19 23:0-41 23:0-41
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 34:0-49
Module not found: Error: Can't resolve './graphql' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'graphql.js'?
BREAKING CHANGE: The request './graphql' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 36:0-47:50
Module not found: Error: Can't resolve './type' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'index.js'?
BREAKING CHANGE: The request './type' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 49:0-53:205
Module not found: Error: Can't resolve './language' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'index.js'?
BREAKING CHANGE: The request './language' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 55:0-101
Module not found: Error: Can't resolve './execution' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'index.js'?
BREAKING CHANGE: The request './execution' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 56:0-68
Module not found: Error: Can't resolve './subscription' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'index.js'?
BREAKING CHANGE: The request './subscription' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 58:0-60:675
Module not found: Error: Can't resolve './validation' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'index.js'?
BREAKING CHANGE: The request './validation' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 62:0-64
Module not found: Error: Can't resolve './error' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'index.js'?
BREAKING CHANGE: The request './error' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
ERROR in ./node_modules/graphql/index.mjs 64:0-98:42
Module not found: Error: Can't resolve './utilities' in '/Users/fk/Desktop/aws/mvp/frontend/node_modules/graphql'
Did you mean 'index.js'?
BREAKING CHANGE: The request './utilities' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/AWSAppSyncRealTimeProvider.js 90:0-39 221:41-53 345:49-61 503:37-49 519:46-58 543:37-49
@ ./node_modules/@aws-amplify/pubsub/lib-esm/Providers/index.js 15:0-45 15:0-45
@ ./node_modules/@aws-amplify/pubsub/lib-esm/index.js 14:0-28 14:0-28
@ ./node_modules/aws-amplify/lib-esm/index.js 27:0-45 27:0-45
@ ./src/components/Header.jsx 8:0-35
@ ./src/App.jsx 6:0-41 9:93-99
@ ./src/index.js 6:0-24 7:41-44
webpack 5.12.3 compiled with 8 errors and 6 warnings in 672 ms
ℹ 「wdm」: Failed to compile.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Module not found: Can't resolve 'graphql'? - Stack Overflow
My Next.js app worked fine yesterday but today it has an error like this: error - ./node_modules/@urql/core/dist/ddbb86ae.mjs:1:0 Module not ...
Read more >graphql-tag - npm
Helpful utilities for parsing GraphQL queries. Includes: gql A JavaScript template literal tag that parses GraphQL query strings into the ...
Read more >Can't resolve 'apollo-upload-client'. I'm on Next.js : r/graphql
I'm using typescript “npm install apollo-upload-client will not work as it includes.js files not the .ts. That's why using @types.
Read more >error: cannot find module 'graphql/language/parser' - You.com
This issue is comes when you use import gql from 'graphql-tag'.Honestly I don't know why graphql-tag not working in snack.expo.io, however it is...
Read more >Webpack can't find loaders for plugins in production - Foreman
pluginName=foreman_remote_execution ModuleNotFoundError: Module not found: Error: Can't resolve 'graphql-tag/loader' in '/usr/share/foreman' at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As mentioned by @Stvad and elsewhere,
resolve.fullySpecified === false
seems to be the key for Webpack5+This worked for me in a Quasar Vue3 (Webpack5) project
A previous iteration of the project but using Quasar Vue 2 (Webpack4), the following worked
ah following the workaround from https://github.com/aws-amplify/amplify-js/issues/7744#issuecomment-778626311 worked for me