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

SyntaxError: Unexpected end of JSON input #719

Closed
marcobarbosa opened this issue Dec 13, 2016 · 7 comments

Comments

@marcobarbosa
Copy link

commented Dec 13, 2016

Hi,

I've started getting this error and could use some clues. It's probably related to my project but why would standardjs fail like this:

> <repo>@1.0.0 standard /Users/marcobarbosa/Repos/<repo>
> standard 'src/**/*.js'

standard: Unexpected linter output:

SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at Object.parseRecursion [as parse] (/Users/marcobarbosa/Repos/<repo>/node_modules/circular-json/build/circular-json.node.js:182:15)
    at readJSON (/Users/marcobarbosa/Repos/<repo>/node_modules/flat-cache/utils.js:15:25)
    at Object.load (/Users/marcobarbosa/Repos/<repo>/node_modules/flat-cache/cache.js:25:23)
    at Object.create (/Users/marcobarbosa/Repos/<repo>/node_modules/flat-cache/cache.js:158:9)
    at Object.load (/Users/marcobarbosa/Repos/<repo>/node_modules/flat-cache/cache.js:144:17)
    at Object.create (/Users/marcobarbosa/Repos/<repo>/node_modules/file-entry-cache/cache.js:13:27)
    at new CLIEngine (/Users/marcobarbosa/Repos/<repo>/node_modules/eslint/lib/cli-engine.js:463:38)
    at /Users/marcobarbosa/Repos/<repo>/node_modules/standard-engine/index.js:107:16
    at /Users/marcobarbosa/Repos/<repo>/node_modules/deglob/index.js:51:12

JSON input? Is it trying to read JSON files?

Using Node v6.92 and standard 8.6.0.

I also get this by running standard directly in the terminal (after installing it globally).

Do you have any ideas?

@LinusU

This comment has been minimized.

Copy link
Member

commented Dec 13, 2016

Maybe your package.json is invalid?

@marcobarbosa

This comment has been minimized.

Copy link
Author

commented Dec 13, 2016

@LinusU Thanks for the tip! I just double checked and it's valid JSON.

Also, here's a npm-debug.log running on node v6.1.0. There are no prestandard or poststandard tasks.

0 info it worked if it ends with ok
1 verbose cli [ '/Users/marcobarbosa/.nvm/versions/node/v6.1.0/bin/node',
1 verbose cli   '/Users/marcobarbosa/.nvm/versions/node/v6.1.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'standard' ]
2 info using npm@3.8.6
3 info using node@v6.1.0
4 verbose run-script [ 'prestandard', 'standard', 'poststandard' ]
5 info lifecycle <repo>d@1.0.0~prestandard: <repo>d@1.0.0
6 silly lifecycle <repo>d@1.0.0~prestandard: no script for prestandard, continuing
7 info lifecycle <repo>d@1.0.0~standard: <repo>d@1.0.0
8 verbose lifecycle <repo>d@1.0.0~standard: unsafe-perm in lifecycle true
9 verbose lifecycle <repo>d@1.0.0~standard: PATH: /Users/marcobarbosa/.nvm/versions/node/v6.1.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/marcobarbosa/Repos/<repo>d/node_modules/.bin:/Users/marcobarbosa/.nvm/versions/node/v6.1.0/bin:/Users/marcobarbosa/.rvm/gems/ruby-2.3.0/bin:/Users/marcobarbosa/.rvm/gems/ruby-2.3.0@global/bin:/Users/marcobarbosa/.rvm/rubies/ruby-2.3.0/bin:/Users/marcobarbosa/google-cloud-sdk/bin:/opt/local/bin:/opt/local/sbin:/Applications/MAMP/bin/php/php5.6.7/bin/php:/Users/marcobarbosa/.nvm/versions/node/v6.1.0/bin:/Users/marcobarbosa/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Users/marcobarbosa/.rvm/bin
10 verbose lifecycle <repo>d@1.0.0~standard: CWD: /Users/marcobarbosa/Repos/<repo>d
11 silly lifecycle <repo>d@1.0.0~standard: Args: [ '-c', 'standard \'src/**/*.js\'' ]
12 silly lifecycle <repo>d@1.0.0~standard: Returned: code: 1  signal: null
13 info lifecycle <repo>d@1.0.0~standard: Failed to exec standard script
14 verbose stack Error: <repo>d@1.0.0 standard: `standard 'src/**/*.js'`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/Users/marcobarbosa/.nvm/versions/node/v6.1.0/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/Users/marcobarbosa/.nvm/versions/node/v6.1.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:850:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid <repo>d@1.0.0
16 verbose cwd /Users/marcobarbosa/Repos/<repo>d
17 error Darwin 16.1.0
18 error argv "/Users/marcobarbosa/.nvm/versions/node/v6.1.0/bin/node" "/Users/marcobarbosa/.nvm/versions/node/v6.1.0/bin/npm" "run" "standard"
19 error node v6.1.0
20 error npm  v3.8.6
21 error code ELIFECYCLE
22 error <repo>d@1.0.0 standard: `standard 'src/**/*.js'`
22 error Exit status 1
23 error Failed at the <repo>d@1.0.0 standard script 'standard 'src/**/*.js''.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the <repo>d package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     standard 'src/**/*.js'
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs <repo>d
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls <repo>d
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Note it mentions EventEmitter, is that related to my code or to some lib standard uses?

standard task in my package.json:

"standard": "standard 'src/**/*.js'",

Also tried ignoring JSON:

"standard": {
    "ignore": [
      "src/**/*.json"
    ]
  }
@feross

This comment has been minimized.

Copy link
Member

commented Dec 24, 2016

This issue is caused by an invalid cache file, which can happen if standard crashes or if you kill standard with Ctrl-C while it is running.

This was a bug in a dependency of standard, which is now fixed. For more information, see: eslint/eslint#7748

@feross feross closed this Dec 24, 2016

@marcobarbosa

This comment has been minimized.

Copy link
Author

commented Dec 26, 2016

Thanks @feross !

@smnayeem

This comment has been minimized.

Copy link

commented Apr 2, 2017

i saw this issue is over here, but i am suffering about this issue as 'syntaxerror: unexpected end of json input' when i am trying to edit order. I had trying to realized the previous solutions. but i am not clear. anyone can explain easily to solve the issue. Opencart version is 2.0.3.1

@feross

This comment has been minimized.

Copy link
Member

commented Apr 3, 2017

@smnayeem Sorry, you're posting on a completely different issue tracker that has nothing to do with OpenCart. Good luck figuring out your issue, though!

@smnayeem

This comment has been minimized.

Copy link

commented Apr 3, 2017

'SyntaxError: Unexpected end of JSON input' the same issue

@standard standard locked and limited conversation to collaborators Apr 3, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.