LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-03-2018, 09:37 PM   #1
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 181

Rep: Reputation: 19
PaperJS Error: SyntaxError: Unexpected token (3:46)


I'm here asking fro help with my homework. Of course, the whole course is homework. It's The Web Developer Bootcamp on Udemy.

In this exercise, I am supposed to print a grid of circles using PaperJS.

I'm getting this error:
Code:
Uncaught SyntaxError: Unexpected token (3:46) paper-full.js:14884
The issue I'm having is that it doesn't tell me which token. I'm assuming the (3:46) is supposed to be the line and character number...

Here's my HTML and Javascript: (EDIT: Found the , where I needed a ;. Still throwing same error, but different line and character number. Now, (4:61))

Code:
<!DOCTYPE html>
<html>
<head>
    <title>Circles</title>
    <link rel="stylesheet" href="assets/css/circles.css">
    <script src="assets/js/lib/paper-full.js"></script>
    <script src="assets/js/circles.js"></script>
    <script type="text/paperscript" canvas="myCanvas">
        for (var x = 0; x < 1000; x += 100) {
            for (var y = 0; y < 1000; y += 100) {
                var circle = new Path.Circle(new Point(x, y) 10);
                circle.fillColor = "purple";
            }
        }
    </script>
</head>
<body>
    <canvas id="myCanvas" resize></canvas>
</body>
</html>
Here's my CSS:
Code:
body, html {
    height: 100%;
    margin: 0;
}
canvas {
    width: 100%;
    background: black;
    height: 100%;
}
Here's my console output from Chrome:
Code:
paper-full.js:14884 Uncaught SyntaxError: Unexpected token (3:46)
    at raise (paper-full.js:14884)
    at unexpected (paper-full.js:15524)
    at expect (paper-full.js:15520)
    at parseFor (paper-full.js:15769)
    at parseStatement (paper-full.js:15608)
    at parseBlock (paper-full.js:15753)
    at parseStatement (paper-full.js:15716)
    at parseFor (paper-full.js:15772)
    at parseStatement (paper-full.js:15608)
    at parseTopLevel (paper-full.js:15544)
All of those line numbers are within the PaperJS file, and I'm fairly sure the actual error isn't there.

Thanks, for any help you can give me.

(NOTE: I'm unable to find any error handling documentation on http://paperjs.org.)

Last edited by killingthemonkey; 03-03-2018 at 10:02 PM.
 
Old 03-04-2018, 03:13 PM   #2
killingthemonkey
Member
 
Registered: Mar 2011
Location: Winston-Salem, NC
Distribution: Fedora, CentOS, Linux Mint
Posts: 181

Original Poster
Rep: Reputation: 19
The issue was very nicely pointed out to me over at Udemy.

This line:
Code:
var circle = new Path.Circle(new Point(x, y) 10);
Should look like this:
Code:
var circle = new Path.Circle(new Point(x, y), 10);
My kingdom for a comma...
 
Old 03-27-2018, 01:23 PM   #3
Steve_Morgan
LQ Newbie
 
Registered: Mar 2018
Location: NY
Posts: 3

Rep: Reputation: Disabled
Please, can you make sure the program JSX is at the top of your files:
/** @jsx React.DOM */
Without this line, the binary and built-in jsx browser will leave your files unchanged.
Question about Unexpected token '<' is interpreted by the absence of the Babel preset.
So, you need to configure the options for your web package:
{
test :/\.jsx?$/,
exclude:/(node_modules|bower_components)/,
loader :'babel',
query :{
presets:['react','es2015']
}
}
here .jsx checks the .js and .jsx formats.
Read here https://stackoverflow.com/questions/...42914#39342914
I'm certainly not an expert, as I work as a writer of the essay for college. But I hope I helped you a little.
 
Old 03-27-2018, 01:23 PM   #4
Steve_Morgan
LQ Newbie
 
Registered: Mar 2018
Location: NY
Posts: 3

Rep: Reputation: Disabled
good luck with your homework

Last edited by Steve_Morgan; 03-28-2018 at 02:54 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error near unexpected token `(' avistasiahaan Linux - Newbie 4 05-30-2012 12:18 PM
Unexpected token error. lorinfarr Linux - Newbie 2 11-06-2011 05:00 PM
syntax error near unexpected token `fi' thomas2004ch Programming 11 08-04-2011 08:53 AM
error: unexpected token `newline' CarlosV Programming 4 05-17-2011 04:47 AM
syntax error near unexpected token Aigarzs Linux - Newbie 3 01-12-2008 04:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration