Urllib browerify: Uncaught TypeError: Cannot read property 'split' of undefined

Viewed 105

I want to use urllib in javascript project (precisely for chrome extension). I need to use some node modules and that includes also urllib. I found out that by using browserify, it is possible to do so. But I got this error after creating the bundle file for urllib. Here is how i tried to include urllib in my project:

  1. npm install urllib --save
  2. browserify -r urllib -o bundle.js

Here is the error I received in bundle.js file:

Uncaught TypeError: Cannot read property 'split' of undefined
var NODE_MAJOR_VERSION = parseInt(process.versions.node.split('.')[0]);

Does anyone know whether it is because urllib is not compatible with browserify or have I overlooked any step?

0 Answers
Related