Jas*_*son 5 node.js express mean-stack multer
我正在使用MEAN堆栈编写Web应用程序.我通过npm安装了multer,如下所示:
sudo npm install -g multer
Run Code Online (Sandbox Code Playgroud)
我在我的一个路线文件中要求它:
var multer = require("multer");
Run Code Online (Sandbox Code Playgroud)
我正在使用nodemon
并且每次重新启动时都会抛出以下错误,因为我添加了require语句.
28 Feb 18:39:13 - [nodemon] restarting due to changes...
28 Feb 18:39:13 - [nodemon] starting `node ./bin/www`
module.js:338
throw err;
^
Error: Cannot find module 'multer'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/jason/Desktop/Node/todoApp/routes/todos.js:8:14)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
28 Feb 18:39:13 - [nodemon] app crashed - waiting for file changes before starting...
Run Code Online (Sandbox Code Playgroud)
我在过去两天安装了mongo,node和express.我正在运行OS X Yosemite版本10.10.2.
Tim*_* Gu 10
您必须在本地安装模块,而不使用-g
标志:
$ npm i multer
Run Code Online (Sandbox Code Playgroud)
或者,您可以将全局安装的模块链接到本地目录,也可以指定环境变量,NODE_PATH
如NodeJS中所示,需要全局模块/包
归档时间: |
|
查看次数: |
6657 次 |
最近记录: |