nuxt: Npm run dev crashes randomly

Hi everyone,

first of all: thanks for this great piece of software. Unfortunately and out of the blue I’m facing an issue that makes it nearly impossible to work with it locally.

Running npm run dev compiles everything nicely and then it’s waiting for changes as it’s supposed to do. Upon saving a file it compiles again but randomly aborts the whole script with the following error message:

Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok),
function fse_dispatch_event, file ../src/fsevents.c, line 147.

Versions

  • nuxt: 2.14.12
  • node: 14.15.4
  • npm: 6.14.11
  • OS: MacOS 10.14.6

Reproduction

I guess it’s hard to reproduce as even here npm run dev aborts not every time I’m saving a file. I’ve added my dependencies from package.json here:

{
  "name": "my-project",
  "version": "1.0.1",
  "private": true,
  "repository": {
    "type": "git",
    "url": "my-repo.com"
  },
  "auto-changelog": {
    "commitUrl": "my-url.com"
  },
  "scripts": {
    "dev": "nuxt-ts",
    "build": "nuxt-ts build",
    "start": "nuxt-ts start",
    "generate": "nuxt-ts generate",
    "lint:js": "eslint --ext .js,.vue --ignore-path .gitignore .",
    "lint": "npm run lint:js",
    "test": "jest",
    "version": "auto-changelog --commit-limit false -p && git add CHANGELOG.md"
  },
  "dependencies": {
    "@fortawesome/fontawesome-free": "^5.15.1",
    "@nuxt/content": "^1.11.1",
    "@nuxt/typescript-runtime": "^1.0.0",
    "@nuxtjs/axios": "^5.12.5",
    "bootstrap": "^4.5.3",
    "bootstrap-vue": "^2.21.2",
    "cookie-universal-nuxt": "^2.1.4",
    "nuxt": "^2.14.12",
    "nuxt-typed-vuex": "^0.1.22",
    "video.js": "^7.10.2"
  },
  "devDependencies": {
    "@nuxt/types": "^2.14.12",
    "@nuxt/typescript-build": "^2.0.3",
    "@nuxtjs/eslint-config": "^3.1.0",
    "@nuxtjs/eslint-config-typescript": "^3.0.0",
    "@nuxtjs/eslint-module": "^2.0.0",
    "@types/video.js": "^7.3.11",
    "@types/webpack": "^4.41.26",
    "@types/webpack-env": "^1.16.0",
    "@vue/test-utils": "^1.1.2",
    "auto-changelog": "^2.2.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.17.0",
    "eslint-plugin-nuxt": "^1.0.0",
    "fsevents": "^2.3.1",
    "jest": "^26.6.3",
    "node-sass": "^4.14.1",
    "sass-loader": "^9.0.3",
    "ts-jest": "^26.4.4",
    "vue-jest": "^3.0.7"
  }
}

What is Expected?

npm run dev compiles again upon saving a file.

What is actually happening?

npm run dev randomly aborts compilation. Upon some file savings it works, then it aborts again.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 24 (4 by maintainers)

Most upvoted comments

I’ve got the same problem, except that it fails in run dev mode on any change in the underlying code. Assertion failed: (napi_create_string_utf8(env, events->events[idx].path, NAPI_AUTO_LENGTH, &args[0]) == napi_ok), function fse_dispatch_event, file …/src/fsevents.c, line 147. error Command failed with signal “SIGABRT”.

I had the same issue and ended up downgrading to fsevents@2.1.0.
In order to do so, I switched from npm to yarn and added a resolutions entry in the package.json that instructs yarn to install this particular version throughout the dependency tree:

"resolutions": {
  "**/fsevents": "2.1.0"
}

Great news 🎉 I’ll close this issue now as it’s been fixed upstream. Anyone still experiencing it should first try yarn upgrade fsevents - and failing that confirm the version they have installed.

FWIW, I ended up downgrading node to v12.20.1 and have not had this issue since.

In my case, this problem occurs just by editing some components in the GLOBAL Component folder. Maybe this helps to narrow it down?

This is relevant for nuxt in general because builder depends on chokidar, and in fact upcoming v2.15 bumps the chokidar version to ^3.5.1. It would be helpful to know if pinning chokidar to a lower version solves the issue for you.

@danielroe I believe you are on the right path. I’m fairly certain that it revolves around the @nuxt/content module. I was on another project using Nuxt, but without the @nuxt/content module, and this error never popped up. Upon further investigation, my nuxt project with the error uses @nuxt/content, which has a dependency of fsevents@2.3.1.

├─┬ @nuxt/content@1.11.1
│ └─┬ chokidar@3.5.1
│   └── fsevents@2.3.1 

Hi @EduardoMateos , do i get you right, that it crashes for you too?

Yes, And it only happens to me on mac!