Cannot find module 'browserify'

I'm getting this error:

Error: Cannot find module 'browserify'

When I add this line to my app/server.js file:

var browserify = require('browserify');

Now I'm still new to Node, but I think I installed it correctly, via

npm install -g browserify

as per their docs.

I'm pretty sure this is the command to check my global modules:

D:WebsitesMySite> npm ls -g
C:UsersMarkAppDataRoamingnpm
├─┬ browserify@1.17.2
│ ├─┬ buffer-browserify@0.0.4
│ │ └── base64-js@0.0.2

It lists browserify there. So why can't I require it?


我面临同样的问题,但如果你想安装browserify模块,你可以使用它

       npm install  browserify        

Try:

npm install js-base64

and if you encounter the below error

npm ERR! Error: EACCES: permission denied, unlink '/Users/host/module/node_modules/npm/node_modules/.bin/node-gyp'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, unlink '/Users/host/module/node_modules/npm/node_modules/.bin/node-gyp']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'unlink',
npm ERR!   path: '/Users/host/module/node_modules/npm/node_modules/.bin/node-gyp' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

then use the below command:

sudo npm install -g js-base64 --save

我必须为全局安装browserify找到另一种方法,以便您可以在linux中使用此命令

sudo npm install browserify -g
链接地址: http://www.djcxy.com/p/33014.html

上一篇: 我无法在npm中安装下划线。 获取以下错误

下一篇: 找不到模块'browserify'