Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npm run dev crashes randomly #8639

Closed
paulmax-os opened this issue Jan 13, 2021 · 24 comments
Closed

Npm run dev crashes randomly #8639

paulmax-os opened this issue Jan 13, 2021 · 24 comments

Comments

@paulmax-os
Copy link

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.

@EduardoMateos
Copy link

+1 . I dont understand, I havent modified anything.
I don't find any pattern when it crash.

@paulmax-os
Copy link
Author

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

@EduardoMateos
Copy link

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

Yes, And it only happens to me on mac!

@EduardoMateos
Copy link

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

I solved this problem with: npm cache clear --force

Hope this can help you

@paulmax-os
Copy link
Author

I already tried that and it didn't solve the problem on my end. I also tried this already
· Remove node_modules folder
· Remove package-lock.json
· npm cache clear --force
· npm install

And the problem does still exist.

@pointer0592
Copy link

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".

@jpcarpenter
Copy link

jpcarpenter commented Jan 21, 2021

I started encountering this issue after upgrading to node v14.15.4

UPDATE:
This error disappears when using a CLI other than the integrated terminal within VS Code.
This error doesn't happen as often when using a CLI other than the integrated terminal within VS Code.

@paulmax-os
Copy link
Author

paulmax-os commented Jan 21, 2021

In my case the issue started with node v12 (something) and I upgraded to v14.15.4 because i thought maybe i need to update my node version to get rid of the issue. But that didn't work out. So it also occurs on node v12.

Copy link
Member

danielroe commented Jan 24, 2021

Possibly related fsevents/fsevents#355 which has same timeline and error - which suggests issue was introduced in fsevents 2.2 and still present in fsevents 2.3.

If you are experiencing this issue, could you inspect your package lockfile for fsevents version and let me know - and if using yarn, try pinning your fsevents dependency to a lower version to see if it fixes the issue.

@jpcarpenter
Copy link

@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 

@jpcarpenter
Copy link

@danielroe would it be best to post this issue on the @nuxt/content issues, or to attempt to pin earlier versions of chokidar with earlier versions of fsevents?

@danielroe
Copy link
Member

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.

@gion
Copy link

gion commented Jan 26, 2021

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"
}

@jpcarpenter
Copy link

Is there a recommended way to pin something with npm? I've tried npm-force-solutions, but it doesn't seem to be working for me.

@JeronimasDargis
Copy link

JeronimasDargis commented Jan 28, 2021

I have noticed the same issue. Im running on macOS Big Sur 11.1
As i notice in only happens when editing GLOBAL components folder
Some of my colleagues reported that this issue does not happen on windows.

Copy link
Member

If anyone is experiencing this, could you take as many of the following steps as you can?

  1. share your package.json and lockfile
  2. create a reproduction
  3. run yarn upgrade chokidar or equivalent for npm
  4. test with nuxt-edge

This would be hugely helpful as it's particularly difficult to fix this kind of issue without more info...

@Jantastic
Copy link

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

@jnrebelo
Copy link

jnrebelo commented Feb 1, 2021

Hi 🖐, I also have this error for a week since starting a new setup, 100% of the time the dev. server crashes on saving files inside the global component subdirectory. On other subdirectories the crash is more sporadic

@pointer0592
Copy link

Good catch jantastic, same scenario here

@impowski
Copy link

impowski commented Feb 4, 2021

I guess this one is related too, when I change something like nuxt.config.js I get this error instantly, but with changing something inside components folder for example the builder is just halted on like 80% or 90% and stays like that for a long time.

@jpcarpenter
Copy link

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

@impowski
Copy link

impowski commented Feb 4, 2021

@jpcarpenter what you did besides downgrading to v12.20.1 because I just downgraded to that version too on Big Sur (M1) and it doesn't change anything for me?

@impowski
Copy link

impowski commented Feb 6, 2021

The problem was fixed with fsevents/fsevents#356, I had an issue with eslint config inside nuxt.config.js, no idea why but I removed it for now.

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants