Search code examples
node.js7zip

How to use 'node-7z' on CentOS?


I want to use node-7z on CentOS. I have tested my app on Mac and it works. When I ran the app on server, it throws an error about

Error: spawn 7z ENOENT
    at exports._errnoException (util.js:860:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at doNTCallback2 (node.js:450:9)
    at process._tickDomainCallback (node.js:405:17)

I think this stated that the app didn't recognize the 7zip correctly but I have already installed 7zip from http://netix.dl.sourceforge.net/project/p7zip/p7zip/15.09/p7zip_15.09_src_all.tar.bz2 and set the $PATH and alias in ~/.bashrc:

export PATH=/data/node/mongodb/bin:/usr/local/bin/:$PATH
alias 7z='7za'

I can run 7z i command so I think it is installed correctly.

The path of 7z is /usr/local/bin/7za.


Solution

  • Finally I resolved this problem by installing p7zip-plugins. So if you want to use 7zip on CentOS, you need:

    sudo yum install p7zip
    sudo yum install p7zip-plugins