在aws控制台上修改我的appsync模式后,我试图运行“ amplify codegen” cli命令以更新本地项目文件。但是,我收到以下错误:
amplify codegen
- Downloading the introspection schema
√ Downloaded the schema
- Generating GraphQL operations
- Generating
undefined
√ Code generated successfully and saved in file
2018-10-29T10:48:28.717Z - error: uncaughtException: GraphQL schema file should contain a valid GraphQL introspection query result date=Mon Oct 29 2018 18:48:28 GMT+0800 (Malay Peninsula Standard Time), pid=4768, uid=null, gid=null, cwd=C:\code_repo\dir\a\react-dashboard, execPath=C:\Program Files\nodejs\node.exe, version=v8.10.0, argv=[C:\Program Files\nodejs\node.exe, C:\Program Files\nodejs\node_modules\@aws-amplify\cli\bin\amplify, codegen], rss=126963712, heapTotal=103223296, heapUsed=79488616, external=390282, loadavg=[0, 0, 0], uptime=1068500.4532678, trace=[column=11, file=C:\Users\kaustavg\amplify-launch\amplify-cli\packages\amplify-graphql-docs-generator\src\generator\generate.ts, function=Object.generate [as default], line=19, method=generate [as default], native=false, column=57, file=C:\Users\kaustavg\amplify-launch\amplify-cli\packages\amplify-graphql-docs-generator\src\index.ts, function=generate, line=43, method=null, native=false, column=11, file=C:\Users\Alex\AppData\Roaming\nvm\v8.10.0\node_modules\@aws-amplify\cli\node_modules\amplify-codegen\src\commands\statements.js, function=projects.forEach, line=35, method=forEach, native=false, column=null, file=null, function=Array.forEach, line=null, method=forEach, native=false, column=12, file=C:\Users\Alex\AppData\Roaming\nvm\v8.10.0\node_modules\@aws-amplify\cli\node_modules\amplify-codegen\src\commands\statements.js, function=generateStatements, line=17, method=null, native=false, column=9, file=C:\Users\Alex\AppData\Roaming\nvm\v8.10.0\node_modules\@aws-amplify\cli\node_modules\amplify-codegen\src\commands\generateStatementsAndType.js, function=Object.generateStatementsAndTypes [as generate], line=27, method=generateStatementsAndTypes [as generate], native=false, column=null, file=null, function=null, line=null, method=null, native=false, column=7, file=internal/process/next_tick.js, function=process._tickDomainCallback, line=228, method=_tickDomainCallback, native=false], stack=[Error: GraphQL schema file should contain a valid GraphQL introspection query result, at Object.generate [as default] (C:\Users\kaustavg\amplify-launch\amplify-cli\packages\amplify-graphql-docs-generator\src\generator\generate.ts:19:11), at generate (C:\Users\kaustavg\amplify-launch\amplify-cli\packages\amplify-graphql-docs-generator\src\index.ts:43:57), at projects.forEach (C:\Users\Alex\AppData\Roaming\nvm\v8.10.0\node_modules\@aws-amplify\cli\node_modules\amplify-codegen\src\commands\statements.js:35:11), at Array.forEach (<anonymous>), at generateStatements (C:\Users\Alex\AppData\Roaming\nvm\v8.10.0\node_modules\@aws-amplify\cli\node_modules\amplify-codegen\src\commands\statements.js:17:12), at Object.generateStatementsAndTypes [as generate] (C:\Users\Alex\AppData\Roaming\nvm\v8.10.0\node_modules\@aws-amplify\cli\node_modules\amplify-codegen\src\commands\generateStatementsAndType.js:27:9), at <anonymous>, at process._tickDomainCallback (internal/process/next_tick.js:228:7)]
什么原因导致这种情况发生?
答案 0 :(得分:1)
当我尝试将项目从一台计算机移动到另一台计算机时,我遇到了类似的问题。
起初,我认为这是内存错误,因为它在生成过程中出错了。
为我解决了错误的事情是安装了GraphQL
软件包。
事实证明,在使用npm安装扩增软件包时,它会显示对graphql的要求,但是如果您使用yarn则不会。