i trying require npm package browserify, have installed globally through command:
npm install -g browserify this file bundle.js in try require browserify:
var browserify = require('browserify'); var fs = require('fs'); var b = browserify(); var outputfilestream = fs.createwritestream('./test_bundle.js'); b.add('index.js'); b.bundle().pipe(outputfilestream); // process.stdout when node build.js error:
error: cannot find module 'browserify' ( etcetera...) if instead install browserify locally:
npm install -g browserify i no error , build goes fine.
i have uploaded small demo program github repository:
https://github.com/loldrup/test_require
so if you're on windows 7 machine, should able reproduce error cloning:
git clone https://github.com/loldrup/test_require and running:
node build edit:
even after adding relevant node paths system variable 'path', , restarted command promt, still can't require globally installed node modules:
node.js doesn't in folder global modules installed default.
add module.paths.push('path global node_modules') @ beginning of script or set enviroment variables.

Comments
Post a Comment