J_shelfwood's avatar

SyntaxError: Unexpected token s on running gulp

I'm suddenly receiving this error whenever i run gulp, even though i haven changed anything in the gulpfile. I've only been editing the admin.scss file, and even when delete all the contents of that file i get this error, so that doesn't seem to be the source of the issue. Here are the contents of my gulpfile.js:

var elixir = require('laravel-elixir');

require('laravel-elixir-stylus');

elixir(function(mix) {
    mix.stylus('collection.styl');
    mix.styles(['vendor/normalize.css', 'collection.css'], null, 'public/css');
    mix.version('public/css/all.css');

    mix.sass('admin.scss');
    mix.version('public/css/admin.css');
});

And here is the full message i get when running gulp:

[14:28:37] Using gulpfile ~/Pneunet-Website/gulpfile.js
[14:28:37] Starting 'default'...
[14:28:37] Starting 'stylus'...

Fetching Stylus Source Files...
   - resources/assets/stylus/collection.styl


Saving To...
   - public/css/collection.css

[14:28:38] Finished 'default' after 1.52 s
[14:28:40] gulp-notify: [Laravel Elixir] Stylus Compiled!
[14:28:40] Finished 'stylus' after 3.56 s
[14:28:40] Starting 'styles'...

Fetching Styles Source Files...
   - public/css/vendor/normalize.css
   - public/css/collection.css


Saving To...
   - public/css/all.css

[14:28:41] gulp-notify: [Laravel Elixir] Stylesheets Merged!
[14:28:41] Finished 'styles' after 54 ms
[14:28:41] Starting 'version'...

Fetching Version Source Files...
   - public/css/all.css


Saving To...
   - public/build

undefined:3
}s"
 ^

SyntaxError: Unexpected token s
    at Object.parse (native)
    at /home/robbin/Pneunet-Website/node_modules/laravel-elixir/tasks/version.js:85:29
    at FSReqWrap.oncomplete (fs.js:82:15)

I'm not sure where this error is coming from because it was working fine a few hours ago and i have only changed the admin.scss file. Does anybody know how i might be able to fix this?

0 likes
5 replies
richard's avatar

That hit a letter 's' by mistake somewhere. Just look for it and delete it.

The full error log trace should tell you which file the error is coming from

J_shelfwood's avatar

This does seem to be the case, but i can't find it anywhere. Could you tell me where i can find the full error log trace?

ejdelmonico's avatar

Delete your node_modules folder and make sure your node version is up to date. Use yarn and re-install node_modules. Try that. It's usually the first thing I do when I get those types of errors.

nauf's avatar

in the public directory go to your build directory and check your rev-menifest.json file... there you can find an extra piece of line added...delete it and then run again

for example change:

{ "js/todo.js": "js/todo-5d52e82a2b.js" }s-330cb53d6f.js" }

to:

{ "js/todo.js": "js/todo-5d52e82a2b.js" }

4 likes
jthorpe's avatar

@nauf I just ran into this and had to commend your answer. Thanks for saving me a bunch of time.

Please or to participate in this conversation.