我正在运行一个 Node 服务器,没有任何问题,出于某种目的,必须删除 node_modules 目录并重新安装依赖项。这样做并再次运行服务器后,我收到此错误:
Error: Cannot find module './common'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Work\Cinde-Node\node_modules\debug\src\node.js:236:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
我使用npm install common
单独安装了common
,但这并没有解决问题。
我该如何解决这个问题?
最佳答案
看起来你有这样一行
require('./common');
它应该是
require('common')
关于node.js - Node : Cannot find module common,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52755446/