简体   繁体   English

如何在 Travis CI 的 PHP 容器上安装特定的 node.js 版本?

[英]How can I install a specific node.js version on a PHP container on Travis CI?

For a Laravel project I use Travis Ci with the language option as PHP.对于 Laravel 项目,我将 Travis Ci 与语言选项一起用作 PHP。 Besides PHP I want to do some Node JS testing.除了 PHP 我想做一些 Node JS 测试。 The default installed version of Node JS does not meet my requirements.默认安装的 Node JS 版本不符合我的要求。 How can I specify the version of Node JS in my config file?如何在我的配置文件中指定 Node JS 的版本?

I have tried the following.我尝试了以下方法。 But unfortunately, that does not work.但不幸的是,这行不通。

language: php

php:
  - '7.0'
  - '7.1'

node_js:
  - '6.10'

In search for an answer to the same question I ended up here, and there , and this helped me:为了寻找同一问题的答案,我最终来到这里和那里,这对我帮助:

language: php

php:
  - 7.0
  - 7.1

before_install:
  - nvm install node 
# "node" is an alias for the latest version

install
  - npm install

Note : Installing this in the before_install section as I am installing the actual packages in the install section.注意:在安装此before_install节,因为我在安装实际的软件包install部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM