Can't make it work with `.js`
wesleycoder opened this issue · 1 comments
I'm installing it in a new machine and can't get it to work with the error:
$ pygmentize -l jsx dev/tavern-web/server.js
*** Error while highlighting:
ValueError: No JSON object could be decoded
(file "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode)
*** If this is a bug you want to report, please rerun with -v.
`dev/tavern-web/server.js` contents:
const next = require('next') const { createServer } = require('http') const { join } = require('path') const { parse } = require('url')const env = require('./config/env')
const app = next()
const handle = app.getRequestHandler()
const staticRoutes = ['/service-worker.js']
const { APP_PORT, PUBLIC_URL, NOW_URL, NODE_ENV } = env.rawexport const serve = async (appPort = APP_PORT, appUrl = (NOW_URL || PUBLIC_URL)) => {
let server
await app.prepare()
server = createServer((req, res) => {
const parsedUrl = parse(req.url, true)
const { pathname } = parsedUrlif (staticRoutes.includes(pathname)) { const filePath = join(__dirname, '.next', pathname) app.serveStatic(req, res, filePath) } else { handle(req, res, parsedUrl) }
})
server.listen(appPort, () => console.log(> Ready on ${appUrl}
))return server
}if (NODE_ENV !== 'test') {
serve()
}export default serve
Verbose stacktrace:
$ pygmentize -l jsx dev/tavern-web/server.js ***************************************************************** An unhandled exception occurred while highlighting. Please report the whole traceback to the issue tracker at . *****************************************************************Traceback (most recent call last):
File "/home/wesleycoder/.local/bin/pygmentize", line 11, in
sys.exit(main())
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/cmdline.py", line 543, in main
return main_inner(popts, args, usage)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/cmdline.py", line 507, in main_inner
highlight(code, lexer, fmter, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/init.py", line 85, in highlight
return format(lex(code, lexer), formatter, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/init.py", line 67, in format
formatter.format(tokens, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/formatters/terminal256.py", line 234, in format
return Formatter.format(self, tokensource, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/formatter.py", line 95, in format
return self.format_unencoded(tokensource, outfile)
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/formatters/terminal256.py", line 237, in format_unencoded
for ttype, value in tokensource:
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygments/lexer.py", line 191, in streamer
for _, t, v in self.get_tokens_unprocessed(text):
File "/home/wesleycoder/.local/lib/python2.7/site-packages/pygmentslexerbabylon/lexer.py", line 153, in get_tokens_unprocessed
tokens = json.loads(out.decode('utf-8'))
File "/usr/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded