打包前端代码在下载依赖的时候报错如下
yarn install v1.19.1
[1/5] Validating package.json…
[2/5] Resolving packages…
[3/5] Fetching packages…
info fsevents@1.2.9: The platform “linux” is incompatible with this module.
info “fsevents@1.2.9” is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies…
[5/5] Building fresh packages…
[-/6] ? waiting…
[2/6] ? nodejieba
[-/6] ? waiting…
[4/6] ? phantomjs-prebuilt
error /mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/phantomjs-prebuilt: Command failed.
Exit code: 1
Command: node install.js
Arguments:
Directory: /mnt/disk50/localRepository/workspace/ALI-V1.0 /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:198:13)
at maybeClose (internal/child_process.js:982:16)
at Socket.stream.socket.on (internal/child_process.js:389:11)
at Socket.emit (events.js:198:13)
at Pipe._handle.close (net.js:606:12)
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:198:13)
at maybeClose (internal/child_process.js:982:16)
warning Error running install script for optional dependency: “/mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/nodejieba: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/nodejieba
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.16.2 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ ‘/mnt/disk50/node-v10.16.2-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py’,
gyp info spawn args ‘binding.gyp’,
gyp info spawn args ‘-f’,
gyp info spawn args ‘make’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/nodejieba/build/config.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/mnt/disk50/node-v10.16.2-linux-x64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi’,
gyp info spawn args ‘-I’,
gyp info spawn args ‘/root/.node-gyp/10.16.2/include/node/common.gypi’,
gyp info spawn args ‘-Dlibrary=shared_library’,
gyp info spawn args ‘-Dvisibility=default’,
gyp info spawn args ‘-Dnode_root_dir=/root/.node-gyp/10.16.2’,
gyp info spawn args ‘-Dnode_gyp_dir=/mnt/disk50/node-v10.16.2-linux-x64/lib/node_modules/npm/node_modules/node-gyp’,
gyp info spawn args ‘-Dnode_lib_file=/root/.node-gyp/10.16.2/<(target_arch)/node.lib’,
gyp info spawn args ‘-Dmodule_root_dir=/mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/nodejieba’,
gyp info spawn args ‘-Dnode_engine=v8’,
gyp info spawn args ‘–depth=.’,
gyp info spawn args ‘–no-parallel’,
gyp info spawn args ‘–generator-output’,
gyp info spawn args ‘build’,
gyp info spawn args ‘-Goutput_dir=.’ ]
gyp info spawn make
gyp info spawn args [ ‘BUILDTYPE=Release’, ‘-C’, ‘build’ ]
make: Entering directory /mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/nodejieba/build' CXX(target) Release/obj.target/nodejieba/lib/index.o make: g++: Command not found make: *** [Release/obj.target/nodejieba/lib/index.o] Error 127 make: Leaving directory
/mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/nodejieba/build’
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/mnt/disk50/node-v10.16.2-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 3.10.0-957.27.2.el7.x86_64
gyp ERR! command “/mnt/disk50/node-v10.16.2-linux-x64/bin/node” “/mnt/disk50/node-v10.16.2-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /mnt/disk50/localRepository/workspace/ALI-V1.0 /node_modules/nodejieba
gyp ERR! node -v v10.16.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok”
info This module is OPTIONAL, you can safely ignore this error
执行yum -y install bzip2即可