cmrigney / fast-xml2js

In-place replacement for xml2js parseString. This is about 20x faster and makes use of the rapidxml C++ library.
https://www.npmjs.com/package/fast-xml2js
MIT License
12 stars 3 forks source link

Installing in docker is broken #6

Open Rush opened 8 years ago

Rush commented 8 years ago
> docker pull node
> docker run -it node /bin/bash
root@4a251ed35176:/# mkdir test
root@4a251ed35176:/# cd test
root@4a251ed35176:/test# npm init -y
root@4a251ed35176:/test# npm install --save fast-xml2js
npm info it worked if it ends with ok
npm info using npm@3.10.3
npm info using node@v6.5.0
npm info attempt registry request try #1 at 9:36:57 PM
npm http request GET https://registry.npmjs.org/fast-xml2js
npm http 304 https://registry.npmjs.org/fast-xml2js
npm info addNameTag [ 'fast-xml2js', 'latest' ]
npm info lifecycle fast-xml2js@1.0.7~preinstall: fast-xml2js@1.0.7
npm WARN lifecycle fast-xml2js@1.0.7~preinstall: cannot run in wd %s %s (wd=%s) fast-xml2js@1.0.7 node-gyp configure && node-gyp build /test/node_modules/.staging/fast-xml2js-5c4308bb
npm info linkStuff fast-xml2js@1.0.7
npm info lifecycle fast-xml2js@1.0.7~install: fast-xml2js@1.0.7
npm info lifecycle fast-xml2js@1.0.7~postinstall: fast-xml2js@1.0.7
test@1.0.0 /test
`-- fast-xml2js@1.0.7 

npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.
npm info ok
root@4a251ed35176:/test# node -r fast-xml2js -e 'true'   
module.js:457
    throw err;
    ^

Error: Cannot find module './fast-xml2js/fast-xml2js.node'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/test/node_modules/fast-xml2js/index.js:1:80)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

This has something to do with the way node-gyp is set up with this package: http://stackoverflow.com/a/19132229/403571

It seems the workaround is npm install --unsafe-perm.

The problem does not exist in other native modules.

cmrigney commented 8 years ago

Thanks for the issue report. Could you provide an example of a native module that doesn't have this issue so I can see what they are doing?

Rush commented 8 years ago

This builds well https://github.com/hooklift/node-libvirt

cmrigney commented 7 years ago

@Rush I've run into the same issue. Any idea how node-libvirt does it without --unsafe-perm?