特拉维斯给出了错误,但在电脑上编译 [英] Travis give error but compiles on pc
问题描述
我正在使用Node.JS创建一个Web服务器,并使用Travis-Ci检查我的代码。我得到的问题是当我提交我的代码时,Travis在下面给出了错误,但代码在我的电脑上编译没有错误:
./ backend / server.js
:1:语法错误: (
意外
在这里你可以找到我的`.travis.yml`文件:
安装:
- npm安装
- npm安装-g bower
- bower安装bootstrap
- bower安装socket.io
语言:node_js
node_js :
- 6.9
before_script:
- chmod < span class =code-digit> 0777 ./backend/server.js
cache:
目录:
- node_modules
- bower_components
和`package.json`
{
name: w atchfriends,
version: 0.0.0,
description: 前端和后端项目监视/ span>,
main: gulpfile.js,
脚本:{
test: ./ backend / server.js
},
repository:{
类型: git,
url: git + https://github.com/WatchFriends/Backend。 git
},
author: Hein P.,Jasper D.,Michiel V.,Michiel Z。,
license: ISC,
错误:{
url: https://github.com/WatchFriends/Backend/issues
},
主页: 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
},
依赖项:{
socket.io: ^ 1.5.1
}
}
On 这个要点,你可以找到我的代码,包括日志。
我有什么不对吗?
提前致谢。
我尝试过的事情:
我试过谷歌但没找到。
我也在Stack Overflow上问它并得到了这个答案:
引用:Travis在测试代码时运行npm测试。
如果检查package.json内部然后您可以看到测试脚本设置为运行./backend/server.js。您需要使用节点运行节点文件。
将其更改为节点./backend/server.js并希望它能正常工作。
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:
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`
{
"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.
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.
这篇关于特拉维斯给出了错误,但在电脑上编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!