简体   繁体   中英

node throws module.js:340 error

I'm using the MEANstack for a project and hit up this error when trying to load the model from seed.js:

module.js:340
throw err;
^
Error: Cannot find module '..api/callout/callout.model'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\onemore\server\config\seed.js:12:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

Proof of existence of the file:

Directory of C:\onemore\server\api\callout

01/27/2015  03:47 PM    <DIR>          .
01/27/2015  03:47 PM    <DIR>          ..
01/27/2015  03:27 PM             2,267 callout.controller.js
01/27/2015  03:47 PM               308 callout.model.js
01/27/2015  03:39 PM               602 index.js

Since I have other models that I set up the exact same way and they are working, I can't explain what is going on.

That's probably ../api/....... rather than ..api/........

Also, make sure that the relative path is correct.

将该路径替换为../api/callout/callout.model

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