defunctzombie / node-process

process information for node.js and browsers
MIT License
122 stars 62 forks source link

process.versions.node is undefined #52

Closed AshokKumarPathak closed 8 years ago

AshokKumarPathak commented 8 years ago

I am doing browserify of “pdf2png-mp” npm module with following steps:

  1. $ sudo npm install pdf2png-mp
  2. $ browserify -r pdf2png-mp -o bundle.js
  3. Created a html file that includes the following:
 <body>
  <script src="bundle.js"></script>
  <script> 
    var md = require('pdf2png-mp');
 </script>
</body>

Actual Results: “TypeError: Cannot read property 'split' of undefined” at bundle.js:667

var version = process.versions.node.split('.').map(function (value) { return parseInt(value, 10); });

Configuration: Processor 2.5 GHz Intel Core i5 Memory 4 GB 1333 MHz DDR3 Software Mac OS X 10.9.4 (13E28)

Version & Build: browserify v12.0.0 npm v3.3.8

calvinmetcalf commented 8 years ago

so first off pdf2png-mp is not going to browserify even if this is fixed because it relies on some stuff that is impossible to browserify

more generally I wonder if it would be useful to fill up process.versions up with empty strings like process.version, e.g.

process.versions = {
  http_parser: '',
  node: '',
  v8: '',
  uv: '',
  zlib: '',
  ares: '',
  icu: '',
  modules: '',
  openssl: ''
}
AshokKumarPathak commented 8 years ago

Thank you calvin for your input.

defunctzombie commented 8 years ago

@calvinmetcalf I think maybe not cause then someone else will have some script that checks for versions being an object and trying to query into the versions maybe. Can't please everyone :)