如何在 Travis CI 的 PHP 容器上安装特定的 node.js 版本? [英] How can I install a specific node.js version on a PHP container on Travis CI?
问题描述
对于 Laravel 项目,我使用 Travis Ci,语言选项为 PHP.除了 PHP 我想做一些 Node JS 测试.默认安装的 Node JS 版本不符合我的要求.如何在我的配置文件中指定 Node JS 的版本?
For a Laravel project I use Travis Ci with the language option as PHP. Besides PHP I want to do some Node JS testing. The default installed version of Node JS does not meet my requirements. How can I specify the version of Node JS in my config file?
我尝试了以下方法.但不幸的是,这行不通.
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
注意:在 before_install
部分安装它,因为我在 install
部分安装实际包.
Note: Installing this in the before_install
section as I am installing the actual packages in the install
section.
这篇关于如何在 Travis CI 的 PHP 容器上安装特定的 node.js 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!