2016-07-19 4 views
4

을 찾을 수 있지만, 내가 해결 방법을 모르는 오류로 실행 할 수 없습니다.Gitlab CI 설치 오류 - 내 루비 온 레일스 프로젝트에 대한 설정 Gitlab CI에 노력하고 자바 스크립트 실행

응용 프로그램은 루비 2.3.1에서 실행되고, 5.0 레일과 PostgreSQL 데이터베이스를 사용하고 있습니다.

나의 현재 .gitlab.ci.yml 파일은 다음과 같다 :

# https://hub.docker.com/r/library/ruby/tags/ 
image: "ruby:2.3.0" 

# Pick zero or more services to be used on all builds. 
# Only needed when using a docker container to run your tests in. 
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-service 
services: 
    - redis:latest 
    - postgres:latest 
    - node:latest 

# This is a basic example for a gem or script which doesn't use 
# services such as redis or postgres 
before_script: 
    - gem install bundler   # Bundler is not installed with the image 
    - bundle install -j $(nproc) # Install dependencies 

rubocop: 
    script: 
    - rubocop 

rspec: 
    script: 
    - rspec spec 

rails: 
    script: 
    - rails db:migrate 
    - rspec spec 

그래서 그것이 실행으로 NodeJS를 사용하기로했다. 그러나 다음 오류가 발생합니다.

$ rails db:migrate 
rails aborted! 
Bundler::GemRequireError: There was an error while trying to load the gem 'uglifier'. 
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. 
Backtrace for gem load error is: 
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in `autodetect' 
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>' 
/usr/local/bundle/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>' 
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:293:in `require' 
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:293:in `block in require' 
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:259:in `load_dependency' 
/usr/local/bundle/gems/activesupport-5.0.0.rc2/lib/active_support/dependencies.rb:293:in `require' 
/usr/local/bundle/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top (required)>' 
+0

이 줄을 추가? 어떤 시스템입니까? https://about.gitlab.com/gitlab-ci/ – miccet

+0

는 시스템입니다. 보시다시피 환경을 설정하기 위해 도커 패키지를 사용하고 있습니다. 위의 내용은 실제로이 CI 서버 (https://about.gitlab.com/gitlab-ci/)의 실제 액세스 권한이없는 시스템에 유효한 ofc입니다. – Severin

답변

4

JavaScript 런타임 (nodejs)이 필요합니다.

우분투 사용자

sudo apt-get install nodejs 

에 CentOS/레드햇 사용자

sudo yum install nodejs 

설치할 수없는 경우 nodejs 당신이 therubyracer 보석을 사용할 수 있습니다. 저장소에서 설명 :

Embed the V8 JavaScript interpreter into Ruby.

는하지만 시스템에 NodeJS 설치 한 적이 Gemfile

gem 'therubyracer', platforms: :ruby 
+0

모두가이 파일에 정의 될 수있다 :이 @miccet – Severin

+0

@Severin 나는 그것 자체에 포함 된 경우 services''고정 표시기 이해하지만 당신은 레일 –

+0

예와 인스턴스'nodejs'을 필요로한다. 문제는 위와 같이 Gitlab CI에서 해당 설정 명령을 실행할 수 없다는 것입니다. 그래서 단순히'before_script' 섹션에 추가하면 오류가 발생합니다. 이 환경에서 어떻게 설정 될 수 있다고 생각하십니까? 1), '보석'therubyracer '을 추가 플랫폼 : – Severin