H. Pauwelyn H. Pauwelyn - 1 year ago 79
Node.js Question

Travis give error but compiles on pc

I'm making a web server with Node.JS and use Travis-Ci to check my code. Yhe problem I got is when I commit my code, Travis gives error below, but the code compiles without an error on my pc:

: 1: Syntax error:

Here you could find my

- npm install
- npm install -g bower
- bower install bootstrap
- bower install socket.io
language: node_js
- "6.9"
- chmod 0777 ./backend/server.js
- node_modules
- bower_components

and the

"name": "watchfriends",
"version": "0.0.0",
"description": "Front-end and back-end project watchfriends",
"main": "gulpfile.js",
"scripts": {
"test": "./backend/server.js"
"repository": {
"type": "git",
"url": "git+https://github.com/WatchFriends/Backend.git"
"author": "Hein P., Jasper D., Michiel V., Michiel Z.",
"license": "ISC",
"bugs": {
"url": "https://github.com/WatchFriends/Backend/issues"
"homepage": "https://github.com/WatchFriends/Backend#readme",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-clean-css": "^2.0.13",
"gulp-concat": "^2.6.1",
"gulp-csslint": "^1.0.0",
"gulp-htmlhint": "^0.3.1",
"gulp-jshint": "^2.0.4",
"gulp-notify": "^2.2.0",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^2.2.0",
"gulp-uglify": "^2.0.0",
"jshint-stylish": "^2.2.1"
"dependencies": {
"socket.io": "^1.5.1"

On this gist, you could find my code, including the log.

Did I something wrong?

Thanks in advance.

Answer Source

Travis runs npm test when testing your code.

If you check inside of your "package.json" file then you can see that the test script is set to run ./backend/server.js. You need to run the node file with node.

Change that to node ./backend/server.js and hopefully that'll work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download