来自 chokidar (C:\) 的错误:错误:EBUSY:资源繁忙或锁定,lstat 'C:\DumpStack.log.tmp

Hel*_*ate 64 angular

使用 Angular 和 ng serve 期间,我收到错误消息:

Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\pagefile.sys'
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\swapfile.sys'
Run Code Online (Sandbox Code Playgroud)

Hel*_*ate 52

每当我使用 VSCode 并添加类似于组件的东西时,我都会得到这个:

@Output() somename = new EventEmitter();
Run Code Online (Sandbox Code Playgroud)

...我让 VSCode 自动导入支持模块。VSCode 没有添加EventEmitter到现有的@angular/core,而是添加了一个protractor导致错误的新导入。

如果您收到此错误并且不记得上次更改的位置,请尝试from 'protractor'在您的代码中搜索;

  • 对这篇文章提出警告;我遇到了来自 chokidar (C:\) 的错误:错误:EBUSY:资源繁忙或锁定,lstat 'something.sys',这是因为我允许 VSCode 为我导入一个包。因此,如果您允许 VSCode 为您导入某些内容,请返回并检查您的导入。他们全部。 - 谢谢! (4认同)
  • 你就救救我吧! (2认同)
  • 爱你3000次,我已经多次下载node_module (2认同)

Reg*_*dit 19

这可能发生在几个不同的构建错误之后。出于某种原因,构建摘要未能报告原始错误并改为报告此错误。

(顺便说一句,我看到 OP 正在使用 Angular 和 ng serve;我在 React 中使用 npm start 得到了这个。所以我猜这可能会在使用任何工具链的 VS Code 中发生。)

我在 VS Code 终端中得到了这个输出:

i ?wdm?: Failed to compile.
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\pagefile.sys'
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\swapfile.sys'
Run Code Online (Sandbox Code Playgroud)

在此页面和其他地方寻找答案后,我没有发现任何对我有用的东西。

但是当我在 VS Code 终端中回滚时,我发现了这个构建错误:

ERROR in ./Components/ServiceBooking/ServiceBooking/ServiceBooking.tsx
Module not found: Error: Can't resolve 'components/Common/BookingComponents/BookingTypeSelector/BookingTypeSelector' in [...]
Run Code Online (Sandbox Code Playgroud)

这是 VS Code 自动添加的导入中的大小写错误。我不知道为什么,但 VS Code 有时会这样做。也许我们可以在这个项目中调整一些东西来帮助 VS Code 不那样做。无论如何,这是一个错误,一旦我通过在导入中将“组件”更改为“组件”来修复它,关于 hiberfil.sys、pagefile.sys 和 swapfile.sys 的次要错误就消失了。

这个故事的寓意是:当心构建摘要掩盖了构建错误。任何时候遇到奇怪的构建错误时,首先要回滚详细的构建输出,以确保您正在寻找正确的错误(原始错误,而不是像这样的次要错误)。


小智 15

检查 package.json 中缺少的依赖项

我正在使用 vue js 我试图运行一个项目并且我遇到了这个错误这个问题是因为其他开发人员使用了全局依赖项并且它没有包含在我的 node_modules 文件夹中


小智 15

按着这些次序:

  1. 删除“node_modules”文件夹
  2. 跑步npm install
  3. 跑步npm cache clean

  • 这可能是解决问题的最有效方法 (4认同)

小智 9

只需编写npm install,它是一个文件查看器,警告未正确更新依赖项。如果没有阅读成千上万我永远不会知道的隐藏评论

解决方案:

npm install
Run Code Online (Sandbox Code Playgroud)


Mar*_*lin 6

如果您使用的是 polyfill,如果您激活以下 polyfill(来自 src/polyfills.ts),则会出现此错误:

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
import 'classlist.js';  // Run `npm install --save classlist.js`.
Run Code Online (Sandbox Code Playgroud)

...并且没有运行相应的 npm install:

npm install --save classlist.js
Run Code Online (Sandbox Code Playgroud)