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

STDIN parsing errors #70

Closed
arnaudlimbourg opened this issue Dec 18, 2012 · 4 comments · Fixed by #146
Closed

STDIN parsing errors #70

arnaudlimbourg opened this issue Dec 18, 2012 · 4 comments · Fixed by #146

Comments

@arnaudlimbourg
Copy link

I run into a strange error when trying to uglify jquery@1.8.3 with uglify-js@2.2.2 :

$ cat jquery-1.8.3.js | uglifyjs
WARN: ERROR: Unexpected token eof «undefined», expected punc «)» [-:2421,35]

lib/node_modules/uglify-js/lib/parse.js:199
    throw new JS_Parse_Error(message, line, col, pos);
               ^
Error
    at new JS_Parse_Error (lib/node_modules/uglify-js/lib/parse.js:185:18)
    at js_error (lib/node_modules/uglify-js/lib/parse.js:199:11)
    at croak (lib/node_modules/uglify-js/lib/parse.js:630:9)
    at token_error (lib/node_modules/uglify-js/lib/parse.js:638:9)
    at expect_token (lib/node_modules/uglify-js/lib/parse.js:651:9)
   at expect (lib/node_modules/uglify-js/lib/parse.js:654:36)
   at parenthesised (lib/node_modules/uglify-js/lib/parse.js:670:9)
   at if_ (lib/node_modules/uglify-js/lib/parse.js:918:20)
   at lib/node_modules/uglify-js/lib/parse.js:758:24
   at lib/node_modules/uglify-js/lib/parse.js:677:24

But if I run it like this:

 $ uglifyjs jquery.js

It only happens with this particular file, backbone or underscore, or even my own code doesn't exhibit this issue.

@rvanvelzen
Copy link
Collaborator

Your example code uses two different files...

@mishoo
Copy link
Owner

mishoo commented Dec 19, 2012

Works for me...

@mishoo mishoo closed this as completed Dec 19, 2012
@arnaudlimbourg
Copy link
Author

I had copy/pasted and removed some info. I started from scratch and I still have the error

$ mkvirtualenv uglifybug
$ npm install uglify-js
$ npm list
  /Users/arnaud/.virtualenvs/uglifybug/lib
└─┬ uglify-js@2.2.2
      ├─┬ optimist@0.3.5
     │   └── wordwrap@0.0.2
     └─┬ source-map@0.1.8
           └── amdefine@0.0.4
$ wget http://code.jquery.com/jquery-1.8.3.js
$ cat jquery-1.8.3.js| /usr/bin/env uglifyjs                                                                                                                (env: uglifybug) 
WARN: ERROR: Unexpected token eof «undefined», expected punc «)» [-:2421,35]

/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:199
    throw new JS_Parse_Error(message, line, col, pos);
          ^
Error
    at new JS_Parse_Error (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:185:18)
    at js_error (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:199:11)
    at croak (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:630:9)
    at token_error (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:638:9)
    at expect_token (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:651:9)
    at expect (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:654:36)
    at parenthesised (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:670:9)
    at if_ (/Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:918:20)
    at /Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:758:24
    at /Users/arnaud/.virtualenvs/uglifybug/lib/node_modules/uglify-js/lib/parse.js:677:24

Running the following command does output any error

$ /usr/bin/env uglifyjs jquery-1.8.3.js

This will hopefully help and make the issue clearer.

I may be doing something wrong but I get this result consistently.

@rvanvelzen sorry for messing up the copy/paste, it was indeed the same file.

@obeattie
Copy link

I get this too. It seems compiling from stdin is completely broken.

$ cat jquery.js | uglifyjs

WARN: ERROR: Unexpected token: eof (undefined) [-:1929,26]

/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:199
    throw new JS_Parse_Error(message, line, col, pos);
          ^
Error
    at new JS_Parse_Error (/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:185:18)
    at js_error (/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:199:11)
    at croak (/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:630:9)
    at token_error (/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:638:9)
    at unexpected (/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:644:9)
    at block_ (/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:937:28)
    at /usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:714:29
    at /usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:677:24
    at if_ (/usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:921:44)
    at /usr/local/share/npm/lib/node_modules/uglify-js/lib/parse.js:758:24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants