简体   繁体   中英

NPM Install is not working. Getting Reference Errors

I am in the process of learning Node.js and web dev all together, I am coming from a mobile dev background and haven't coded in a few years.

I cloned a project from github and was planning on building on top of it for a learning project.

I am running npm install to add some dependencies to the project and they seem to be installing properly. They are succesfully being added to the node_modules directory as well as being added as a dependancy to package.json

However when running the app I get these errors

ReferenceError: Multer is not defined
    at Object.<anonymous> (/Users/willjamieson/airdrive/app.js:26:21)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

There are other dependancies that are working properly within the app but those are ones that were with the project when I initially forked it.

var express = require('express');
var app = express();
var path = require('path');
var formidable = require('formidable');
var fs = require('fs');
var multer = require("multer");
var bodyParser = require("body-parser");
var Minio = require("minio");

I added multer bodyParsr and Minio those don't work everything else came with the original clone and work flawlessly when I remove the packages I installed.

Javascript is case sensitive. Your error says Multer is not defined and in your code shown you define var multer = require("multer");

Try var Multer = require("multer");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM