强制使用1.9.8 PhantomJS和karma-phantomjs-launcher

时间:2016-03-16 13:50:45

标签: npm phantomjs karma-runner

我有一个构建过程...其中一个步骤是在Karma上使用PhantomJS运行测试。不幸的是karma-phantomjs-launcher会自动提取"phantomjs-prebuilt": ">=1.9",这会从互联网上获取最新的PhantomJS(2.1.1)。在linux机器上我收到了这个错误:

[11:21:15][Step 1/1] > gom-filters@1.0.4 test /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac

[11:21:15][Step 1/1] > karma start test/karma.conf.js --single-run --browsers PhantomJS

[11:21:15][Step 1/1] 

[11:21:17][Step 1/1] 16 03 2016 11:21:17.569:INFO [karma]: Karma v0.13.21 server started at http://localhost:9876/

[11:21:17][Step 1/1] 16 03 2016 11:21:17.583:INFO [launcher]: Starting browser PhantomJS

[11:21:17][Step 1/1] 16 03 2016 11:21:17.603:ERROR [phantomjs.launcher]: /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib64/libz.so.1: no version information available (required by /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)

[11:21:17][Step 1/1] /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)

[11:21:17][Step 1/1] /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)

[11:21:17][Step 1/1] /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.9' not found (required by /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)

[11:21:17][Step 1/1] /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.10' not found (required by /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)

[11:21:17][Step 1/1] /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by /sbclocal/apps/BuildAgent/work/5d1d4b9ee540b3ac/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs)

我尝试手动启动PhantomJS 1.9.8并且工作正常。

有没有办法强制下载1.9.8而不是最新的(2.1.1)?

1 个答案:

答案 0 :(得分:2)

在package.json中明确指定PhantomJS依赖版本为1.9.8解决了这个问题。