这是什么意思?
throw new Error("Cannot find module '" + request + "'");
当我安装一个软件包时,我得到了错误!为什么呢?
我是usig express。
e.g。
npm install -g moment
m = require('moment');
答案 0 :(得分:4)
如果要在脚本中使用它,则必须在本地安装它。如果要在shell中使用它,请全局安装。
http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/
基本上,在没有npm install moment
标志的情况下运行-g
,它会起作用。