TypeError:callSite.getFileName 不是 npm start 上 callSiteLocation (/node_modules/depd/index.js:252:23) 处的函数
当我在从 github 克隆的项目中进行 npm install 时然后 npm start 我收到错误:
/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252
var file = callSite.getFileName() || '<anonymous>'
^
TypeError: callSite.getFileName is not a function
at callSiteLocation (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252:23)
at depd (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:111:14)
at Object.<anonymous> (/Users/abc/Documents/Projects/test-project/node_modules/body-parser/index.js:14:32)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Module._compile (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:136:24)
at Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Object.newLoader [as .js] (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:141:7)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
这个“depd”库在所有出现的情况下都会抛出错误,因为它是各种 npm 包(如 body-parser 和)的依赖项。表达。所以它从所有这些内部抛出错误。
然而,我在同一个 github 存储库中的现有设置(我没有从头开始进行 npm install)似乎工作正常。 我尝试使用不同的nodeJs版本6.9.5、10.xx、11.xx、12.xx进行npm安装 我也在使用 Babel v7。
When I am doing npm install in the project that I clone from github & then npm start I am getting error:
/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252
var file = callSite.getFileName() || '<anonymous>'
^
TypeError: callSite.getFileName is not a function
at callSiteLocation (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252:23)
at depd (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:111:14)
at Object.<anonymous> (/Users/abc/Documents/Projects/test-project/node_modules/body-parser/index.js:14:32)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Module._compile (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:136:24)
at Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Object.newLoader [as .js] (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:141:7)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
This 'depd' library is throwing error from all the occurrences as it is a dependancy in various npm packages like body-parser & express. So it is throwing error from within all of them.
However my existing setup from same github repo where I am not doing npm install from scratch seem to be working fine.
I have tried doing npm install with different nodeJs versions 6.9.5, 10.x.x, 11.x.x, 12.x.x
Also I am using Babel v7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 Node.js 升级到最新的 LTS。我在 12.x 上遇到了这个错误,所以升级到 16.x 修复了它。
Upgrade Node.js to the latest LTS. I was on 12.x and had this error, so upgrading to 16.x fixed it.