vuejs - Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'

Viewed 8858

Description

Everytime I run npm run serve the following error code appears:

ERROR  Failed to compile with 1 error                                                                     15:34:19

This dependency was not found:

* ... in ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifie
r":"1a1491e2-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./no
de_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Ho
me.vue?vue&type=template&id=8dc7cce2&

To install it, you can run: npm install --save ...
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'

This error seemed to arise after adding a bootstrap carousel in my ./components/file.vue. although I fail to understand how the carroussel is linked to the npm chokidar package.

What I've tried

This issue being a duplicate of Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp, I tried the solutions suggested without solving anything. I also tried npm install --save as suggested by the error code as well as npm cache clean --force. I have uninstalled the npm chokidar package, which didn't solve the issue, and deleted the C:\DumpStack.log.tmp file too. Finally I also installed the bootstrap-vue npm package which had no effect on the bug. None of the following have solved the issue althought I am aware this probably a pretty basic error.

package.json

{
  "name": "vuejs-client",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "3": "^2.1.0",
    "axios": "^0.21.1",
    "bootstrap-vue": "^2.21.2",
    "chokidar": "^3.5.1",
    "core-js": "^3.6.5",
    "vue": "^2.6.11",
    "vue-router": "^3.5.1"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {}
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

I followed the following tutorial as frame of reference for what I want to achieve with this website: https://bezkoder.com/vue-node-express-mongodb-mevn-crud/

3 Answers

Well as stated, the error was pretty basic. I just had copy pasted the template for the carousel from Bootstrap and forgotten to replace the placeholders.

Sorry for the disturbances and may this help underline the fact that you really have to link the dots before asking the question as the solution can be quite basic.

This problem happened to me after installing JSON-SERVER globally and watching the server. I'm not sure if that was the cause but it happened right after the watching started.

I aborted the watch and the app wouldn't load with npm run serve.

I tried everything suggested by every forum post I could find including npm install, cache clean, cache clean --force, resetting my computer, disabling anti-virus and I have no malware software installed.

The only thing that finally worked was creating a whole new project and copying and pasting the files from the old corrupt one into a new one.

I don't understand why JSON Server should have anything to do with the cause unless the watching locks folders and renders the app unrunnable.

I will try again after I make a few copies of my app to experiment on because copying and pasting files is not a fun job unless your project is small enough.

UPDATE: I think the solution to this problem is don't install json-server globally. Install it locally and use npx json-server --watch to watch. Otherwise a globally installed json-server will watch the entire drive through that app. That's why I had to copy the code into a new app uninstall json-server globally and reinstall it locally .

Related