ipenywis/react-nestjs-full-web-app

schema:dowload and schema:generate-watch in react package.json can't run

daydreamerli opened this issue · 2 comments

can't run these two commands, even the git clone version the watch command still fails.
$ npx apollo service:download --endpoint=http://localhost:8000/graphql ./src/app/graphql-schema.json
Error: Cannot find module 'graphql/validation/rules/KnownArgumentNamesRule'
Require stack:
- /usr/local/lib/node_modules/apollo/node_modules/@apollo/federation/dist/composition/validate/preNormalization/tagDirective.js
- /usr/local/lib/node_modules/apollo/node_modules/@apollo/federation/dist/composition/validate/preNormalization/index.js
- /usr/local/lib/node_modules/apollo/node_modules/@apollo/federation/dist/composition/validate/index.js
- /usr/local/lib/node_modules/apollo/node_modules/@apollo/federation/dist/composition/composeAndValidate.js
- /usr/local/lib/node_modules/apollo/node_modules/@apollo/federation/dist/composition/index.js
- /usr/local/lib/node_modules/apollo/node_modules/@apollo/federation/dist/index.js
- /usr/local/lib/node_modules/apollo/node_modules/apollo-language-server/lib/providers/schema/file.js
- /usr/local/lib/node_modules/apollo/node_modules/apollo-language-server/lib/providers/schema/index.js
- /usr/local/lib/node_modules/apollo/node_modules/apollo-language-server/lib/project/base.js
- /usr/local/lib/node_modules/apollo/node_modules/apollo-language-server/lib/index.js
- /usr/local/lib/node_modules/apollo/lib/Command.js
- /usr/local/lib/node_modules/apollo/lib/commands/service/download.js
- /usr/local/lib/node_modules/apollo/node_modules/@oclif/config/lib/plugin.js
- /usr/local/lib/node_modules/apollo/node_modules/@oclif/config/lib/config.js
- /usr/local/lib/node_modules/apollo/node_modules/@oclif/config/lib/index.js
- /usr/local/lib/node_modules/apollo/node_modules/@oclif/command/lib/command.js
- /usr/local/lib/node_modules/apollo/node_modules/@oclif/command/lib/index.js
- /usr/local/lib/node_modules/apollo/bin/run
Code: MODULE_NOT_FOUND
error Command failed with exit code 1.

I fixed this issue for myself. Ensure that you are using version GraphQL version 15.5.0 and @apollo/client version 3.3.19. Then you want to install the apollo CLI as a dependency in your project by running npm install -D apollo. After that, remove the npx parts within the scripts of your package.json for the schema:download and schema:generate-watch commands. You may also need to delete your node_modules folder and run yarn install again. After that, you should be able to run the commands with no issues.

Yeah, I have solved this as well, thanks for the response. Now both apollo cli and codegen library works for me. Now I'm have a new trouble with the redux login set up,any idea?