The company recently migrated the front-end test server and found one during the migration process. PhantomJs Questions. There is this dependency package in the configuration file, but there is no problem in downloading dependencies locally, but after push code, phantoms installation is always reported to fail in the process of downloading dependencies on the test server.
The error information is as follows:
error /***/node_modules/phantomjs-prebuilt: Command failed. Exit code: 1 Command: node install.js Arguments: Directory: /***/node_modules/phantomjs-prebuilt Output: PhantomJS not found on PATH Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 Verified checksum of previously downloaded file Extracting tar contents (via spawned process) Error extracting archive Phantom installation failed { Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 tar (child): bzip2: Cannot exec: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now at ChildProcess.exithandler (child_process.js:294:12) at ChildProcess.emit (events.js:189:13) at maybeClose (internal/child_process.js:970:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) killed: false, code: 2, signal: null, cmd: 'tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2' } Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 tar (child): bzip2: Cannot exec: No such file or directory tar (child): Error is not recoverable: exiting now tar: Child returned status 2 tar: Error is not recoverable: exiting now at ChildProcess.exithandler (child_process.js:294:12) at ChildProcess.emit (events.js:189:13) at maybeClose (internal/child_process.js:970:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. ERROR: Job failed: exit status 1
* Location is the directory address of your project on the server
PhantomJs is a virtual browser. It is mainly used for unit testing in the front-end project. Our company's front-end project does not do unit testing, so this dependency should come from the template used in the initial project creation. Just remove it directly.
However, as a qualified programmer, the direct removal of this dependence does not fundamentally solve the problem, so, of course, we have to study it. After two days of waste, we found that it was only because the server did not have the bzip2 decompression tool, just need to install it, so it is no problem and waste. Two days later, I felt like I. Q. was feeding the dog.
Back to the point, how to install bzip2?
yum install bzip2
It's OK to execute the above commands on the server. It's that simple.