nuxt: Lock dir not cleaned on compromised lock & fatal error lock is already released

Version

v2.5.1

Reproduction link

https://github.com/nuxt/nuxt.js

Steps to reproduce

  • Start a build that takes some time to finish
  • run: touch -t 200012311800 ./node_modules/.cache/nuxt/build-lock-*.lock
  • wait for the Unable to update lock warning to be displayed
    • this appears to only ever show between webpack builds (eg when a Client/Modern/Server finishes)

image

  • wait for the build to finish

image

What is expected ?

Only the warning should be displayed. Not sure why the trace is showing, probably consola feature?

What is actually happening?

  • A Nuxt fatal error is printed about ‘Error: Lock is already released’
  • the ./node_modules/.cache/nuxt folder still contains the .lock folder (the other folder is removed)

Additional comments?

Will have a look at this, creating this issue for reference

<div align="right">This bug report is available on Nuxt community (#c8888)</div>

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 21
  • Comments: 25 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I’m also change my package.json from "build": "nuxt build", to "build": "nuxt build --no-lock", it’s work for me

--no-lock flag helps

This also happened to us (Nuxt 2.5.1 with Typescript).

I managed to circumvent the issue by deleting the node_modules, reinstalling all packages and building fresh. A lock file was not deleted in the node_modules/.cache/.nuxt build cache.

it occurred to me when nuxt build in version 2.5.1, i think it is not fixed 2.5.0 -> 2.5.1

Have recently got this after upgrading to 2.5.1. Using yarn.

I’m receiving it on a docker image with node 10.7.0 running on bitbucket pipelines, build time is 77.23s. OS is ubuntu 16.

Working fine for me locally on Mac, node 10.7.0, with a build time of 167.98s.

Exact same code. Downloading entire node_modules folder each time. Weird thing is if I mount myself in the container i’m using in pipelines locally, it works fine also 🤔🤔

For people here, see my comment here about possible causes: https://github.com/nuxt/nuxt.js/issues/5331#issuecomment-475852783

Bottom line is, if you are using Node v9 then upgrade to v10 (which is a lts release and had major performance improvements). If you are already on v10+, we still dont understand yet why the lock gets compromised so often in some environments.