如何解决我收到一个错误找不到模块,它抛出一个错误 internal/modules/cjs/loader.js:638
我收到这样的错误
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module '/home/alignminds/Desktop/insidersBackendgit/insiderbackend/app/modules/settings/settings.router'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.module.exports.LoadModules (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/app/config/lib/express.js:209:9)
at Object.module.exports.init (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/app/config/lib/express.js:241:10)
at Object.init (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/app/config/lib/app.js:18:23)
at Object.start (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/app/config/lib/app.js:29:11)
at Object.<anonymous> (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/main.js:2:7)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
只有当我将新文件添加到我的项目中时才会出现此错误,否则它工作正常 我的节点版本是 v10.23.2 我在互联网上搜索并找到了很多解决方案,但没有一个对我有用 比如清除缓存,删除 node_modules 和 package.lock.json 并使用 nvm 升级到 v12, 但是每当我升级到 v12 时,我都会收到这样的错误
ReferenceError: primordials is not defined
at fs.js:36:5
at req_ (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/node_modules/natives/index.js:143:24)
at Object.req [as require] (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/node_modules/webshot/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/node_modules/webshot/node_modules/graceful-fs/graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/alignminds/Desktop/insidersBackendgit/insiderbackend/node_modules/webshot/lib/webshot.js:2:10)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
这个错误很早就出现了,这就是我降级到 v10.23.2 的原因 谁能帮我解决这些问题 提前致谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。