节点js-错误:找不到模块“ app / helpers / gate”

时间:2019-01-15 15:10:29

标签: javascript node.js node-modules nodemon

当我尝试启动克隆的应用程序时出现此错误:

    $ npm start

> askarya-nodejs@1.0.0 start D:\Users\Documents\GitHub\askarya-nodejs
> nodemon server.js

[nodemon] 1.18.9
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js index.js`
internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module 'app/helpers/gate'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\Users\Documents\GitHub\askarya-nodejs\index.js:13:14)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:774:12)
    at executeUserCode (internal/bootstrap/node.js:342:17)
    at startExecution (internal/bootstrap/node.js:276:5)
    at startup (internal/bootstrap/node.js:227:5)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
[nodemon] app crashed - waiting for file changes before starting...

存储库位于GITHUB,我相信引起问题的文件位于PROBLEM FILE

1 个答案:

答案 0 :(得分:0)

给它一个相对路径

 require('./app/models/permission') // add ./