Relay Compiler Syntax Error: Expected Name, found "}" - graphql

could not figure out why my query has syntax errors for hours.
I copy and paste the query to graphiql and it works fine. When I ran relay compiler against my js, it threw this error.
Does anyone have the same issue?
The weird thing is if I remove the "query HomeQuery", it gave different error to complain about operation name..
my code
import {graphql} from "react-relay";
const query = graphql`
query HomeQuery {
tasks {
id
}
}
`;
my package.json
...
"relay": "relay-compiler --schema ../resources/schema.graphql --src ./pages/test"
...
I ran npm run-script relay
the log
relay-compiler --schema ../resources/schema.graphql --src ./pages/test
Writing js
ERROR:
Syntax Error: Expected Name, found "}".
npm ERR! code ELIFECYCLE
npm ERR! errno 100
npm ERR! my-app2#0.1.0 relay: `relay-compiler --schema ../resources/schema.graphql --src ./pages/test`
npm ERR! Exit status 100
npm ERR!
npm ERR! Failed at the my-app2#0.1.0 relay script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

turnout it is just your schema cannot have empty
type Mutation {
}
after I revmoed the empty type Mutation, everything is working....

Related

Strapi Graphql Plugin Crashes Strapi Server

I just tried to install the graphql plugin for strapi (i.e., strapi-plugin-graphql). When I tried to install it via the admin interface, I got the following error message:
The restart takes longer than expected
The server should have restarted, please check your logs in the terminal
When I check my terminal, this is what I see:
[2019-12-27T07:47:12.612Z] debug GET /admin/plugins (5 ms) 200
[2019-12-27T07:47:15.882Z] info Installing graphql...
[2019-12-27T07:48:59.105Z] info File changed: C:\code\tutorials\react\Gatsby\strapi\startup-reporter\package.json[2019-12-27T07:48:59.279Z] debug POST /admin/plugins/install (103411 ms) 200
[2019-12-27T07:48:59.281Z] info The server is restarting
[2019-12-27T07:49:14.672Z] debug ⛔️ Server wasn't able to start properly.
[2019-12-27T07:49:14.674Z] error Error: Field "Query.news" can only be defined once.
at assertValidSDL (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql\validation\validate.js:108:11)
at Object.buildASTSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql\utilities\buildASTSchema.js:71:34)
at Object.buildSchemaFromTypeDefinitions (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql-tools\dist\generate\buildSchemaFromTypeDefinitions.js:23:28)
at makeExecutableSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql-tools\dist\makeExecutableSchema.js:26:29)
at Object.generateSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi-plugin-graphql\services\Schema.js:300:22)
at Object.initialize (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi-plugin-graphql\hooks\graphql\index.js:59:50)
at Promise.resolve.then (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi\lib\hooks\index.js:37:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! startup-reporter#0.1.0 dev: `strapi develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the startup-reporter#0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\moshe\AppData\Roaming\npm-cache\_logs\2019-12-27T07_49_14_697Z-debug.log
Any idea why I am getting this error message and how to fix it?
UPDATE:
I should note that I did a fresh install of strapi and then installed the graphql plugin -- and it installed properly. It only didn't work with an installation that already had custom post types. I don't know why that is -- and what I can do to install it with those custom post types. Any ideas?
Here is the issue about this problem
https://github.com/strapi/strapi/issues/1198
Some words are not well managed for the pluralize version.
So the issue is due to that point.
There is currently nothing to do to fix it by your own.

Jasmine's exclude/focus operations cause exit status 1

I have Karma running Jasmine tests. I run these using npm scripts which, ultimately, use Angular CLI's ng test.
When I try to use xdescribe, xit, fdescribe, or fit, my tests run as expected, but I see an error.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! {my package#version} test-watch: `ng test`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the {my package#version} test-watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm complains loudly about the error. ng test doesn't complain, but fails to go into a watch. I assume ng is also aborting because of the exit status.
Is this failed exit by design? Is it up to the reporter?
This turned out to be a failed coverage threshold. Obviously, excluding some or nearly all specs or suites greatly affected the coverage.

Now is not recognized as an internal or external command - when attempting to host a page with Zeit

"scripts": {
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"build-css": "node-sass-chokidar src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --
watch --recursive",
"now-start": "node server/server.js",
"deploy": "now --public --dotenv=.env.prod -d"
},
"now": {
"alias": "lendahand"
}
}
Greetings. I'm trying to host a project with Zeit but I am getting an error I don't know how to fix. The error is saying that now is not an internal or external command, but it appears to be showing up in my package.json. I don't know how to remedy this situation. Do you have any suggestions?
The error is:
persona-project2-front#0.1.0 deploy C:\Users\Kim\DevMountain\LendAHandPP
> now --public --dotenv=.env.prod -d
'now' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! persona-project2-front#0.1.0 deploy: `now --public --
dotenv=.env.prod -d`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the persona-project2-front#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Kim\AppData\Roaming\npm-cache\_logs\2017-11-
06T23_38_07_616Z-debug.log
Add the directory that now exists in to your PATH/path environmental variable, then you can use now. Make sure to close and re-open your terminal for the env. var. to take effect.
If that's not working, first make sure to install now like this:
npm install now -g to install it globally in your global npm/node_modules directory.
Then test it.
Thirdly, if that is not working, it could be a problem with the environmental variable not being set, so you may need to get root/administrator access and set that in the PATH env var for your system. As for the terminal, maybe try opening your terminal with admin access, or if on linux try something like sudo now.
Finally, after doing your npm install now -g it should display some messages like
'... -> C:\Users\\AppData\Roaming\npm\node_modules\now\download\dist\now ...'
Use that directory to work with now. This would open now process inside your terminal, your directory to now may be different, make sure to set this directory in your PATH if possible.

npm Windows 7 error

I am helping someone get through running npm in Windows 7. When npm update is executed, the following error (ENOENT, scandir) is returned. But the folder that npm could not find has been verified to exist, and the user running npm has full permissions on the folder. Below are the details of the npm-debug.log for this error:
18265 silly fetchPackageMetaData errno: -4058,
18265 silly fetchPackageMetaData code: 'ENOENT',
18265 silly fetchPackageMetaData syscall: 'scandir',
18265 silly fetchPackageMetaData path: 'C:\\Users\<\userpath\>\\npm-cache\\_git-remotes\\git-github-com-polymerelements-test-fixture-git-8142662e\\HEAD' }
18266 silly rollbackFailedOptional Starting
18267 silly rollbackFailedOptional Finishing
18268 silly runTopLevelLifecycles Finishing
18269 silly install printInstalled
18270 verbose stack Error: ENOENT: no such file or directory, scandir 'C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD'
18271 verbose cwd C:\Users\\<userpath\>\git\PredixDev\predix-seed
18272 error Windows_NT 6.1.7601
18273 error argv "G:\\nodejs\\node.exe" "G:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "update" "--no-optional"
18274 error node v7.2.0
18275 error npm v3.10.9
18276 error path C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD
18277 error code ENOENT
18278 error errno -4058
18279 error syscall scandir
18280 error enoent ENOENT: no such file or directory, scandir 'C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD'
18281 error enoent ENOENT: no such file or directory, scandir 'C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD'
18281 error enoent This is most likely not a problem with npm itself
18281 error enoent and is related to npm not being able to find a file.
18282 verbose exit [ -4058, true ]
I'm not familiar at all with using Node on Windows. Please help, thank you. (NOTE: I've replaced specific user folder information above with \ to sanitize the info.)
One possible cause is security software that filters access to the file system, like DigitalGuardian. If it's a corporate machine with something like that installed, you may need to get your IT people to whitelist Node.
https://github.com/npm/npm/issues/10729

"npm faq" fails on Windows 7 ("spawn ENOENT" errors)

I have installed node.js on Windows 7 with their latest installer. It seemed to work, I can call npm and node from the console (either cmd or PowerShell), but I keep getting errors.
There are a lot of questions here about node.js on windows, but they all mention some specific piece of code. I'm getting the "spawn ENOENT" with a lot of simple commands, for instance yo, if I then pick "update generators" :
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
even npm faq fails :
PS E:\www\something> npm faq
npm ERR! Error: spawn ENOENT
npm ERR! at errnoException (child_process.js:988:11)
npm ERR! at Process.ChildProcess._handle.onexit (child_process.js:779:34)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/isaacs/npm/issues>
It seems that the problem is that node uses unix command names like dir, which do not exist on Windows. Some blog posts mention using Cygwin, but mostly for building node.js, not for calling it. The official nodejs website doesn't mention that cygwin is a prerequisite, either.
Here's the npm-debug.log :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'faq' ]
2 info using npm#1.3.24
3 info using node#v0.10.25
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 error Error: spawn ENOENT
5 error at errnoException (child_process.js:988:11)
5 error at Process.ChildProcess._handle.onexit (child_process.js:779:34)
6 error If you need help, you may report this *entire* log,
6 error including the npm and node versions, at:
6 error <http://github.com/isaacs/npm/issues>
7 error System Windows_NT 6.1.7601
8 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "faq"
9 error cwd E:\
10 error node -v v0.10.25
11 error npm -v 1.3.24
12 error syscall spawn
13 error code ENOENT
14 error errno ENOENT
15 verbose exit [ 1, true ]
Make sure that you have c:\Windows\System32 on your 'Path' System Variable. I was having this exact problem and this was the fix I needed. I must have taken it out in error sometime in the past.

Resources