ashthespy / Atom-LaTeX

The only LaTeX package you need for typesetting with Atom.
https://atom.io/packages/atom-latex
MIT License
22 stars 9 forks source link

Uncaught SyntaxError: Unexpected token S in JSON at position 0 #139

Closed matthiaschung closed 6 years ago

matthiaschung commented 6 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.23.3 x64 Electron: 1.6.15 OS: Mac OS X 10.13.2 Thrown From: atom-latex package 0.8.4

Stack Trace

Uncaught SyntaxError: Unexpected token S in JSON at position 0

At file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.html:1

SyntaxError: Unexpected token S in JSON at position 0
    at JSON.parse (<anonymous>)
    at Viewer.module.exports.Viewer.wsHandler (/packages/atom-latex/lib/viewer.coffee:18:17)
    at /packages/atom-latex/lib/server.coffee:23:47)
    at emitOne (events.js:96:13)
    at WebSocket.emit (events.js:188:7)
    at Receiver._receiver.onmessage (/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141:47)
    at Receiver.dataMessage (/packages/atom-latex/node_modules/ws/lib/Receiver.js:389:14)
    at Receiver.getData (/packages/atom-latex/node_modules/ws/lib/Receiver.js:330:12)
    at Receiver.startLoop (/packages/atom-latex/node_modules/ws/lib/Receiver.js:165:16)
    at Receiver.add (/packages/atom-latex/node_modules/ws/lib/Receiver.js:139:10)
    at Socket._ultron.on (/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138:22)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:551:20)

Commands

  6x -0:56.3.0 core:move-right (input.hidden-input)
     -0:55.2.0 core:move-down (input.hidden-input)
     -0:54.7.0 core:move-up (input.hidden-input)
 17x -0:54.3.0 core:move-right (input.hidden-input)
     -0:51.8.0 core:backspace (input.hidden-input)
 74x -0:51.3.0 core:move-right (input.hidden-input)
     -0:43.8.0 core:backspace (input.hidden-input)
  7x -0:42.9.0 core:move-right (input.hidden-input)
     -0:40.7.0 core:move-down (input.hidden-input)
 11x -0:40.4.0 core:move-right (input.hidden-input)
     -0:32.8.0 core:backspace (input.hidden-input)
 25x -0:31.9.0 core:move-right (input.hidden-input)
     -0:28.1.0 core:backspace (input.hidden-input)
     -0:27.6.0 editor:move-to-end-of-screen-line (input.hidden-input)
     -0:26.8.0 core:backspace (input.hidden-input)
     -0:26.2.0 core:save (input.hidden-input)

Non-Core Packages

atom-clock 0.1.16 
atom-html-preview 0.2.5 
atom-latex 0.8.4 
auto-detect-indentation 1.3.0 
autocomplete-bibtex 1.2.0 
busy-signal 1.4.3 
city-lights-syntax 1.1.6 
city-lights-ui 1.3.1 
custom-folds 1.9.5 
file-icons 2.1.16 
fizzy 0.21.0 
fizzy-syntax-theme 0.9.0 
flatwhite-syntax 0.8.1 
fonts 3.0.3 
highlight-selected 0.13.1 
indent-detective 0.2.0 
ink 0.8.2 
intentions 1.1.5 
julia-client 0.6.8 
language-julia 0.15.0 
language-latex 1.1.1 
latex 0.49.0 
latex-completions 0.3.3 
latextools 0.8.5 
linter 2.2.0 
linter-ui-default 1.6.10 
minimap 4.29.7 
minimap-highlight-selected 4.6.1 
monokai-slate 0.6.0 
pdf-view 0.65.0 
script 3.17.3 
split-diff 1.5.2 
teletype 0.7.0 
tool-bar 1.1.4 
uber-juno 0.1.2 
wordcount 2.10.4 
ashthespy commented 6 years ago

Any information on how to reproduce this error?

matthiaschung commented 6 years ago

Sorry, for not providing more information. It is reproducible. Every time I compile a latex document (via atom-latex using command-s) will lead to this error.

ashthespy commented 6 years ago

Since I can't debug - could I request you to?

  1. Open your Atom-LaTeX code ( Settings -> Packages -> Atom LaTeX -> Settings -> View Code)
  2. Add console.log(msg) right before the data = JSON.parse msg line in viewer.coffee
  3. Restart Atom (ctrlshiftf5)
  4. Open the debug console (ctrlshifti)

let me know what msg looks like?

matthiaschung commented 6 years ago

I got to 4. in your description. I am running Atom on Mac and the short cut for debug console does not work. How do I start it? Thanks so much for looking into this

ashthespy commented 6 years ago

View -> Developer -> Toggle Developer Tools

matthiaschung commented 6 years ago

Is this what you are looking for? Thanks!

No deserializer found for http://127.0.0.1:57248/viewer.html?file=preview.pdf
deserialize @ <embedded>:21133
<embedded>:121025 IntersectionObserver.observe(target): target element is not a descendant of root.
TreeView @ <embedded>:121025
latextools.coffee [sm]:304 requiring if needed: snippet-manager
snippet-manager.coffee [sm]:10 Created SnippetManager
snippet-manager.coffee [sm]:13 Set snippet service
snippet-manager.coffee [sm]:14 Object
index.html:1 WebSocket connection to 'wss://ws-mt1.pusher.com/app/f119821248b7429bece3?protocol=7&client=js&version=4.2.2&flash=false' failed: WebSocket is closed before the connection is established.
/Users/mcchung/.atom/packages/teletype/lib/teletype-package.js:42 teletype: Using pusher key: f119821248b7429bece3
/Users/mcchung/.atom/packages/teletype/lib/teletype-package.js:43 teletype: Using base URL: https://api.teletype.atom.io
<embedded>:1037 EACCES: permission denied, symlink '/Applications/Atom.app/Contents/Resources/app/atom.sh' -> '/usr/local/bin/atom'
(anonymous) @ <embedded>:1037
<embedded>:1042 EACCES: permission denied, symlink '/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm' -> '/usr/local/bin/apm'
(anonymous) @ <embedded>:1042
viewer.coffee [sm]:128 The provided value 'moz-chunked-arraybuffer' is not a valid enum value of type XMLHttpRequestResponseType.
viewer.coffee [sm]:18 {"type":"open","path":"preview.pdf"}
viewer.coffee [sm]:18 {"type":"loaded"}
viewer.coffee [sm]:128 PDF 7e8a4a715c47881fc3ae1b1300ec601d [1.5 pdfTeX-1.40.18 / LaTeX with Beamer class] (PDF.js: 1.9.426 [WebGL])
2viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa9841000]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa891e600]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa896ae00]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa90f0200]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
2viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa90c6800]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa80d1e00]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa90e2400]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa992dc00]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
viewer.coffee [sm]:128 [.Offscreen-For-WebGL-0x7fefa818e800]GL ERROR :GL_INVALID_OPERATION : glUniform4fv: wrong uniform function for type
ashthespy commented 6 years ago

Interesting - would you be able to share the (minimal) source files that leads to this error?

Also, can you try setting in the file viewer/viewer.js "enableWebGL": true, to "enableWebGL": false, and refresh atom and check if you still have this issue?

matthiaschung commented 6 years ago

Weird, while trying to set up a minimal example with reproducible error, I now cannot reproduce the error at all.

On Feb 12, 2018, at 9:36 AM, Ash notifications@github.com wrote:

Interesting - would you be able to share the (minimal) source files that leads to this error?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/James-Yu/Atom-LaTeX/issues/139#issuecomment-364940731, or mute the thread https://github.com/notifications/unsubscribe-auth/ARFV0j-I-EJbRue9-86I8D_QmpE7ilanks5tUEx-gaJpZM4SA4mz.

ashthespy commented 6 years ago

This is with WebGL enabled or disabled?

matthiaschung commented 6 years ago

How do I find that out? I essentially didn’t make any “conscious” changes. Thanks for the help.

On Feb 13, 2018, at 4:41 AM, Ash notifications@github.com wrote:

This is with WebGL enabled or disabled?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/James-Yu/Atom-LaTeX/issues/139#issuecomment-365208191, or mute the thread https://github.com/notifications/unsubscribe-auth/ARFV0tBt8vJYAuWUf22GUbj_w2DYeGBAks5tUVjSgaJpZM4SA4mz.

ashthespy commented 6 years ago

Then it's enabled - you can counter check by looking at the developer console - you should see a line like PDF 7e8a4a715c47881fc3ae1b1300ec601d [1.5 pdfTeX-1.40.18 / LaTeX with Beamer class] (PDF.js: 1.9.426 [WebGL])

I could imagine that the document you were compiling had some figures that WebGL had issues rendering - leading to this error. But we can't confirm this without a MWE :-(

matthiaschung commented 6 years ago

PDF 9c79d33407a45216c8831d52182e14de [1.5 pdfTeX-1.40.18 / LaTeX with Beamer class] (PDF.js: 1.9.426 [WebGL])

Interesting… I am not aware that I changed any involved figure. I will post if I see this error occurring again. Thanks a lot…

On Feb 13, 2018, at 4:46 AM, Ash notifications@github.com wrote:

Then it's enabled - you can counter check by looking at the developer console - you should see a line like PDF 7e8a4a715c47881fc3ae1b1300ec601d [1.5 pdfTeX-1.40.18 / LaTeX with Beamer class] (PDF.js: 1.9.426 [WebGL])

I could imagine that the document you were compiling had some figures that WebGL had issues rendering - leading to this error. But we can't confirm this without a MWE :-(

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/James-Yu/Atom-LaTeX/issues/139#issuecomment-365209587, or mute the thread https://github.com/notifications/unsubscribe-auth/ARFV0sar9-b8K_ShfWYsClyui8J5lM--ks5tUVoAgaJpZM4SA4mz.

matthiaschung commented 6 years ago

Okay, now I can reproduce the error! Just the simple document below will produce the error.: \documentclass[12pt]{article} \begin{document} Test \end{document} However, it starts with synchronizing back from the pdf (in the atom-pdf viewer) to the latex file. It first throws back the error below followed by the described error. After that each every tex document will create above's error. I hope that helps to pinpoint the error.

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.23.3 x64 Electron: 1.6.15 OS: Mac OS X 10.13.2 Thrown From: atom-latex package 0.8.4

Stack Trace

Uncaught SyntaxError: Unexpected token  in JSON at position 0

At file:///Applications/Atom.app/Contents/Resources/app.asar/static/index.html:1

SyntaxError: Unexpected token  in JSON at position 0
    at JSON.parse (<anonymous>)
    at Viewer.module.exports.Viewer.wsHandler (/packages/atom-latex/lib/viewer.coffee:19:17)
    at /packages/atom-latex/lib/server.coffee:23:47)
    at emitOne (events.js:96:13)
    at WebSocket.emit (events.js:188:7)
    at Receiver._receiver.onmessage (/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141:47)
    at Receiver.dataMessage (/packages/atom-latex/node_modules/ws/lib/Receiver.js:389:14)
    at Receiver.getData (/packages/atom-latex/node_modules/ws/lib/Receiver.js:330:12)
    at Receiver.startLoop (/packages/atom-latex/node_modules/ws/lib/Receiver.js:165:16)
    at Receiver.add (/packages/atom-latex/node_modules/ws/lib/Receiver.js:139:10)
    at Socket._ultron.on (/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138:22)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:551:20)

Commands

  2x -4:09.0 core:save (input.hidden-input)
  9x -2:13 core:backspace (input.hidden-input)
     -1:57 editor:select-to-first-character-of-line (input.hidden-input)
  2x -1:56.6.0 core:backspace (input.hidden-input)
     -1:55.7.0 core:save (input.hidden-input)
     -1:46.2.0 editor:move-to-first-character-of-line (input.hidden-input)
  2x -1:45.8.0 core:backspace (input.hidden-input)
     -1:44.5.0 core:move-down (input.hidden-input)
     -1:44.1.0 editor:move-to-first-character-of-line (input.hidden-input)
     -1:43.8.0 core:backspace (input.hidden-input)
  5x -1:42 core:move-left (input.hidden-input)
     -1:40.3.0 core:move-up (input.hidden-input)
     -1:35.8.0 core:copy (input.hidden-input)

Non-Core Packages

atom-clock 0.1.16 
atom-html-preview 0.2.5 
atom-latex 0.8.4 
auto-detect-indentation 1.3.0 
autocomplete-bibtex 1.2.0 
busy-signal 1.4.3 
city-lights-syntax 1.1.6 
city-lights-ui 1.3.1 
custom-folds 1.9.5 
file-icons 2.1.16 
fizzy 0.21.0 
fizzy-syntax-theme 0.9.0 
flatwhite-syntax 0.8.1 
fonts 3.0.3 
highlight-selected 0.13.1 
indent-detective 0.2.0 
ink 0.8.2 
intentions 1.1.5 
julia-client 0.6.8 
language-julia 0.15.0 
language-latex 1.1.1 
latex 0.49.0 
latex-completions 0.3.3 
latextools 0.8.5 
linter 2.2.0 
linter-ui-default 1.6.10 
minimap 4.29.7 
minimap-highlight-selected 4.6.1 
monokai-slate 0.6.0 
pdf-view 0.65.0 
script 3.17.3 
split-diff 1.5.2 
teletype 0.7.0 
tool-bar 1.1.6 
uber-juno 0.1.2 
wordcount 2.10.4 
ashthespy commented 6 years ago

What exactly do you mean by 'However, it starts with synchronizing back from the pdf (in the atom-pdf viewer) to the latex file.'?

Also, can you post whats on the debug console when this happens? (you should still have the console.log msg line right? :-)

matthiaschung commented 6 years ago

The console log message, which I receive when I try to sync from the pdf to the latex document (by this I mean double click on the pdf document to find the corresponding text position in the latex document. I think this uses \usepackage(pdfsync}) is below. After this happens, any time compiling will lead to the described error. Thanks.

Uncaught TypeError: Cannot read property 'file' of undefined at Manager.module.exports.Manager.findMainSelfMagic (/Users/mcchung/.atom/packages/atom-latex/lib/manager.coffee:111:5) at Manager.module.exports.Manager.findMainSequence (/Users/mcchung/.atom/packages/atom-latex/lib/manager.coffee:88:21) at Manager.module.exports.Manager.findMain (/Users/mcchung/.atom/packages/atom-latex/lib/manager.coffee:54:15) at Manager.module.exports.Manager.findPDF (/Users/mcchung/.atom/packages/atom-latex/lib/manager.coffee:145:10) at Locator.module.exports.Locator.locate (/Users/mcchung/.atom/packages/atom-latex/lib/locator.coffee:54:31) at Viewer.module.exports.Viewer.wsHandler (/Users/mcchung/.atom/packages/atom-latex/lib/viewer.coffee:48:37) at WebSocket. (/Users/mcchung/.atom/packages/atom-latex/lib/server.coffee:23:47) at emitOne (events.js:96:13) at WebSocket.emit (events.js:188:7) at Receiver._receiver.onmessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141:47) at Receiver.dataMessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389:14) at Receiver.getData (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330:12) at Receiver.startLoop (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165:16) at Receiver.add (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139:10) at Socket._ultron.on (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138:22) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) at TCP.onread (net.js:551:20)

ashthespy commented 6 years ago

Hmm, any reason you don't use SyncTeX? AFAIK, pdfsync is an obsolete package.

matthiaschung commented 6 years ago

I use synctex and abandoned pdfsync, however, the error persists.

ashthespy commented 6 years ago

@matthiaschung Lets try and fix this once in for all ;-) I. Repeat steps from previous comment if not already there: 1a. Open your Atom-LaTeX code ( Settings -> Packages -> Atom LaTeX -> Settings -> View Code) 2a. Add console.log(msg) right before the data = JSON.parse msg line in viewer.coffee 3a. Restart Atom (ctrlshiftf5) 4a. Open the debug console (ctrlshifti)

II. Copy paste from the debug console the message you see! (not the stack trace as in the comments above) III. Try running the synctex command from the console to rule out errors from there. ` III. Provide me a small MWE if possible that causes this message?

matthiaschung commented 6 years ago

Okay, I followed the instruction to the best of my knowledge.

Below the log I see. I ran pdflatex with synctex from the terminal and that works fine. Atom does generate the pdf file but throws back the error.

This is what I see after starting:

:21133 No deserializer found for http://127.0.0.1:54423/viewer.html?file=preview.pdf deserialize @ :21133 :121025 IntersectionObserver.observe(target): target element is not a descendant of root. TreeView @ :121025 :1037 EACCES: permission denied, symlink '/Applications/Atom.app/Contents/Resources/app/atom.sh' -> '/usr/local/bin/atom' (anonymous) @ :1037 :1042 EACCES: permission denied, symlink '/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm' -> '/usr/local/bin/apm’ This is the output of the errors: manager.coffee [sm]:111 Uncaught TypeError: Cannot read property 'file' of undefined at Manager.module.exports.Manager.findMainSelfMagic (manager.coffee [sm]:70) at Manager.module.exports.Manager.findMainSequence (manager.coffee [sm]:54) at Manager.module.exports.Manager.findMain (manager.coffee [sm]:30) at Manager.module.exports.Manager.findPDF (manager.coffee [sm]:90) at Locator.module.exports.Locator.locate (locator.coffee [sm]:40) at Viewer.module.exports.Viewer.wsHandler (viewer.coffee [sm]:17) at WebSocket. (server.coffee [sm]:12) at emitOne (events.js:96) at WebSocket.emit (events.js:188) at Receiver._receiver.onmessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141) at Receiver.dataMessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389) at Receiver.getData (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330) at Receiver.startLoop (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165) at Receiver.add (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139) at Socket._ultron.on (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138) at emitOne (events.js:96) at Socket.emit (events.js:188) at readableAddChunk (_stream_readable.js:176) at Socket.Readable.push (_stream_readable.js:134) at TCP.onread (net.js:551) module.exports.Manager.findMainSelfMagic @ manager.coffee [sm]:111 module.exports.Manager.findMainSequence @ manager.coffee [sm]:88 module.exports.Manager.findMain @ manager.coffee [sm]:54 module.exports.Manager.findPDF @ manager.coffee [sm]:145 module.exports.Locator.locate @ locator.coffee [sm]:54 module.exports.Viewer.wsHandler @ viewer.coffee [sm]:30 (anonymous) @ server.coffee [sm]:23 emitOne @ events.js:96 emit @ events.js:188 _receiver.onmessage @ /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141 dataMessage @ /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389 getData @ /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330 startLoop @ /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165 add @ /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139 _ultron.on @ /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138 emitOne @ events.js:96 emit @ events.js:188 readableAddChunk @ _stream_readable.js:176 Readable.push @ _stream_readable.js:134 onread @ net.js:551 viewer.coffee [sm]:18 ��hi��K�� ��J �� ��J��K���� Կ ųDK��K��YY��XX��XQ��^\��Q_��_G��[\��\[��QQ��^4���� VM2230:1 Uncaught SyntaxError: Unexpected token � in JSON at position 0 at JSON.parse () at Viewer.module.exports.Viewer.wsHandler (viewer.coffee [sm]:9) at WebSocket. (server.coffee [sm]:12) at emitOne (events.js:96) at WebSocket.emit (events.js:188) at Receiver._receiver.onmessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141) at Receiver.dataMessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389) at Receiver.getData (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330) at Receiver.startLoop (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165) at Receiver.add (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139) at Socket._ultron.on (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138) at emitOne (events.js:96) at Socket.emit (events.js:188) at readableAddChunk (_stream_readable.js:176) at Socket.Readable.push (_stream_readable.js:134) at TCP.onread (net.js:551) I hope that helps. > On Feb 19, 2018, at 3:07 PM, Ash wrote: > > @matthiaschung Lets try and fix this once in for all ;-) > I. Repeat steps from previous comment if not already there: > 1a. Open your Atom-LaTeX code ( Settings -> Packages -> Atom LaTeX -> Settings -> View Code) > 2a. Add console.log(msg) right before the data = JSON.parse msg line in viewer.coffee > 3a. Restart Atom (ctrlshiftf5) > 4a. Open the debug console (ctrlshifti) > > II. Copy paste from the debug console the message you see! (not the stack trace as in the comments above) > III. Try running the synctex command from the console to rule out errors from there. > ` > III. Provide me a small MWE if possible that causes this message? > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub , or mute the thread . >
ashthespy commented 6 years ago

Hmm, the 'can't find file' errors can be negated for now by launching the 'Build Latex' while activating the editor - i.e placing your cursor in the editor. (The proper fix is scheduled for the next update)

I am still missing the msg i.e actual JSON that is being attempted to parse and is failing from the debug console, can you try building the document with the cursor in the the document? and then report back? :-)

matthiaschung commented 6 years ago

Thanks. Here is the JSON error:

Uncaught SyntaxError: Unexpected token � in JSON at position 0 at JSON.parse () at Viewer.module.exports.Viewer.wsHandler (viewer.coffee [sm]:9) at WebSocket. (server.coffee [sm]:12) at emitOne (events.js:96) at WebSocket.emit (events.js:188) at Receiver._receiver.onmessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141) at Receiver.dataMessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389) at Receiver.getData (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330) at Receiver.startLoop (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165) at Receiver.add (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139) at Socket._ultron.on (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138) at emitOne (events.js:96) at Socket.emit (events.js:188) at readableAddChunk (_stream_readable.js:176) at Socket.Readable.push (_stream_readable.js:134) at TCP.onread (net.js:551)

On Feb 19, 2018, at 5:01 PM, Ash notifications@github.com wrote:

Hmm, the can't file find of errors can be negated for now by launching the 'Build Latex' while activating the editor - i.e placing your cursor in the editor. (The proper fix is scheduled for the next update)

I am still missing the msg i.e actual JSON that is being attempted to parse and is failing from the debug console, can you try building the document with the cursor in the the document? and then report back? :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/James-Yu/Atom-LaTeX/issues/139#issuecomment-366812910, or mute the thread https://github.com/notifications/unsubscribe-auth/ARFV0s9-RjKp8mCmOM4ujmFuHxYYG0Smks5tWe8-gaJpZM4SA4mz.

ashthespy commented 6 years ago

Hi, what you have posted is the stack trace again, it would be nice to get the actual string that isn't being able to be parsed. This will be available from the debug console (https://github.com/James-Yu/Atom-LaTeX/issues/139#issuecomment-366791568) Please copy paste the output from the debug console after you get the error - unfortunately, the stack trace dones't really help in this case.

matthiaschung commented 6 years ago

Hi Ash, I followed the instruction from above. Maybe I misunderstand a step but this is what I see after starting atom (two more error messages below):

:21133 No deserializer found for http://127.0.0.1:49175/viewer.html?file=preview.pdf deserialize @ :21133 :1037 EACCES: permission denied, symlink '/Applications/Atom.app/Contents/Resources/app/atom.sh' -> '/usr/local/bin/atom' (anonymous) @ :1037 :1042 EACCES: permission denied, symlink '/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/apm' -> '/usr/local/bin/apm' (anonymous) @ :1042 If I double click to sync, i get the following log error: Uncaught TypeError: Cannot read property 'file' of undefined at Manager.module.exports.Manager.findMainSelfMagic (manager.coffee [sm]:70) at Manager.module.exports.Manager.findMainSequence (manager.coffee [sm]:54) at Manager.module.exports.Manager.findMain (manager.coffee [sm]:30) at Manager.module.exports.Manager.findPDF (manager.coffee [sm]:90) at Locator.module.exports.Locator.locate (locator.coffee [sm]:40) at Viewer.module.exports.Viewer.wsHandler (viewer.coffee [sm]:17) at WebSocket. (server.coffee [sm]:12) at emitOne (events.js:96) at WebSocket.emit (events.js:188) at Receiver._receiver.onmessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141) at Receiver.dataMessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389) at Receiver.getData (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330) at Receiver.startLoop (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165) at Receiver.add (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139) at Socket._ultron.on (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138) at emitOne (events.js:96) at Socket.emit (events.js:188) at readableAddChunk (_stream_readable.js:176) at Socket.Readable.push (_stream_readable.js:134) at TCP.onread (net.js:551) module.exports.Manager.findMainSelfMagic | @ | manager.coffee [sm]:111 -- | -- | --   | module.exports.Manager.findMainSequence | @ | manager.coffee [sm]:88   | module.exports.Manager.findMain | @ | manager.coffee [sm]:54   | module.exports.Manager.findPDF | @ | manager.coffee [sm]:145   | module.exports.Locator.locate | @ | locator.coffee [sm]:54   | module.exports.Viewer.wsHandler | @ | viewer.coffee [sm]:30   | (anonymous) | @ | server.coffee [sm]:23   | emitOne | @ | events.js:96   | emit | @ | events.js:188   | _receiver.onmessage | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141   | dataMessage | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389   | getData | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330   | startLoop | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165   | add | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139   | _ultron.on | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138   | emitOne | @ | events.js:96   | emit | @ | events.js:188   | readableAddChunk | @ | _stream_readable.js:176   | Readable.push | @ | _stream_readable.js:134   | onread | @ | net.js:551 If I then compile again, I get that error log: Uncaught SyntaxError: Unexpected token LJ in JSON at position 0 at JSON.parse () at Viewer.module.exports.Viewer.wsHandler (viewer.coffee [sm]:9) at WebSocket. (server.coffee [sm]:12) at emitOne (events.js:96) at WebSocket.emit (events.js:188) at Receiver._receiver.onmessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141) at Receiver.dataMessage (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389) at Receiver.getData (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330) at Receiver.startLoop (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165) at Receiver.add (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139) at Socket._ultron.on (/Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138) at emitOne (events.js:96) at Socket.emit (events.js:188) at readableAddChunk (_stream_readable.js:176) at Socket.Readable.push (_stream_readable.js:134) at TCP.onread (net.js:551) module.exports.Viewer.wsHandler | @ | viewer.coffee [sm]:19 -- | -- | --   | (anonymous) | @ | server.coffee [sm]:23   | emitOne | @ | events.js:96   | emit | @ | events.js:188   | _receiver.onmessage | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:141   | dataMessage | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:389   | getData | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:330   | startLoop | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:165   | add | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/Receiver.js:139   | _ultron.on | @ | /Users/mcchung/.atom/packages/atom-latex/node_modules/ws/lib/WebSocket.js:138   | emitOne | @ | events.js:96   | emit | @ | events.js:188   | readableAddChunk | @ | _stream_readable.js:176   | Readable.push | @ | _stream_readable.js:134   | onread | @ | net.js:551 Thanks
ashthespy commented 6 years ago

Ah, maybe I wasn't clear enough :-) I am also having a bit of trouble understanding how you "If I double click to sync". As far as I know, the command is ctrl/cmd+click in the PDF preview to get from PDF --> TeX

For the first error (Uncaught TypeError: Cannot read property 'file' of undefined) that you get, like I said, the fix will land in the next update, until then, please ensure that your text editor is active i.e click on the tab with the <filename.tex> to activate it before using the menu to build.

Now for the main issue of Uncaught SyntaxError: Unexpected token LJ in JSON at position 0

  1. Open up the dev console
  2. Activate your <filename.tex> editor tab
  3. Trigger the JSON error!
  4. Head back to the dev console, there should now be output printed from the console.log(msg) that you added to viewer.coffee before the actual error. For example - mine looks something like this

image

Good luck! :-)

ashthespy commented 6 years ago

Closing given the silence, feel free to comment if you are still having issues!