0

Im trying to install office lib via npm on Ubutun 14.04. and its doesn't work. Im using Node: v4.4.0, npm: v.2.14.20 and python: v2.6.9

After running npm install office, I get the following output:

make: *** [Release/obj.target/node_expat/node-expat.o] Error 1
make: Leaving directory `/home/apps/lsb.gorillab.co/node_modules/office/node_modul                                                          es/xml2json/node_modules/node-expat/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/                                                          node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.                                                          js:200:12)
gyp ERR! System Linux 3.13.0-83-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gy                                                          p/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/apps/lsb.gorillab.co/node_modules/office/node_modules/xml2json/                                                          node_modules/node-expat
gyp ERR! node -v v4.4.0
gyp ERR! node-gyp -v v3.3.0
gyp ERR! not ok
npm info node-expat@2.0.0 Failed to exec install script
npm ERR! Linux 3.13.0-83-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-d" "office"
npm ERR! node v4.4.0
npm ERR! npm  v2.14.20
npm ERR! code ELIFECYCLE

npm ERR! node-expat@2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.0.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-expat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm info preuninstall node-expat@2.0.0
npm info uninstall node-expat@2.0.0
npm info postuninstall node-expat@2.0.0
npm info preuninstall xml2json@0.3.2
npm info uninstall xml2json@0.3.2
npm info postuninstall xml2json@0.3.2
npm info preuninstall office@0.0.8
npm info uninstall office@0.0.8
npm info postuninstall office@0.0.8

npm ERR! Please include the following file with any support request:
npm ERR!     /home/apps/lsb.gorillab.co/npm-debug.log

Many thanks for any help you can provide.

1 Answers1

1

The problem is that the version of node-expat being installed is too old to support node v4+. A more recent version such as v2.3.13 (which is the latest as of this writing) is needed for node v4+ compatibility.

Since node-expat in this case is being installed as a dependency, you would need walk up the dependency tree and get each module's maintainers to update their dependencies where appropriate, starting with xml2json and then to office. In this particular case though, it seems xml2json is already pulling in the newer version of node-expat and it's office that needs to update its xml2json dependency. Unfortunately the office module hasn't been updated in 2 years, so you may need to fork it and update the dependency yourself if you want to use that module.

mscdex
  • 104,356
  • 15
  • 192
  • 153
  • Thank for your reply, but I keep to find out the another answer, I dont know why office lib can installed on some ubuntu computer with newest node version. – user3422449 Mar 26 '16 at 15:41
  • The `office` module will install on older node versions such as node v0.10.x because it is depending on other older modules (namely `node-expat`) that were designed specifically for those older node versions, so that is the only way it could be working anywhere else. – mscdex Mar 26 '16 at 15:44
  • Alright, I've reinstall node to v0.10 and its working now. Many thank so much dude! – user3422449 Mar 26 '16 at 16:41