Click here to Skip to main content
15,888,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

./backend/server.js: 1: Syntax error: ( unexpected

Here you could find my `.travis.yml` file:

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


and the `package.json`

JSON
{
  "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.

What I have tried:

I've tried to Google it but nothing found.
Posted
Updated 16-Nov-16 6:01am
v2

1 solution

I've also ask it on Stack Overflow and got this answer:

Quote:
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900