Skip to content

Nx fails on build-storybook when package-lock.json is excluded in .gitignore #30627

Closed
@eyalellenbogen

Description

@eyalellenbogen

Current Behavior

Trying to run build-storybook in a monorepo fails if the package-lock.json file is excluded in .gitignore.

It stops with the following error:

Daemon process terminated and closed the connection

Expected Behavior

build-storybook should run successfully without depending on .gitignore exclusions.

GitHub Repo

https://github.com/eyalellenbogen/nx-storybook-issue

Steps to Reproduce

  1. clone the example repo
  2. run npm install and nx build-storybook sb

To fix:

  1. Remove the package-lock.json line from .gitignore
  2. run nx build-storybook sb again

Nx Report

Node           : 20.19.0
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 10.8.2

nx                     : 20.7.1
@nx/js                 : 20.7.1
@nx/eslint             : 20.7.1
@nx/workspace          : 20.7.1
@nx/angular            : 20.7.1
@nx/cypress            : 20.7.1
@nx/devkit             : 20.7.1
@nx/eslint-plugin      : 20.7.1
@nx/module-federation  : 20.7.1
@nx/rspack             : 20.7.1
@nx/storybook          : 20.7.1
@nx/web                : 20.7.1
@nx/webpack            : 20.7.1
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/storybook/plugin
---------------------------------------
Community plugins:
@storybook/angular : 8.6.12
angular-eslint     : 19.3.0
---------------------------------------
Cache Usage: 0.00 B / 95.23 GB

Failure Logs

Error: The externalDependency 'storybook' for 'my-storybook:build-storybook' could not be found
    at NativeTaskHasherImpl.hashTasks (....project\node_modules\nx\src\hasher\native-task-hasher-impl.js:32:36)
    at InProcessTaskHasher.hashTasks (....project\node_modules\nx\src\hasher\task-hasher.js:62:50)
    at handleHashTasks (....project\node_modules\nx\src\daemon\server\handle-hash-tasks.js:30:56)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async handleResult (....project\node_modules\nx\src\daemon\server\server.js:170:16)
    at async handleMessage (....project\node_modules\nx\src\daemon\server\server.js:111:9)
    at async ....project\node_modules\nx\src\daemon\server\server.js:73:9 {
  code: 'GenericFailure'
}

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

This happens on v19 and v20.

Metadata

Metadata

Assignees

Labels

priority: mediumMedium Priority (not high, not low priority)scope: storybookIssues related to Storybook support in Nxtype: bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions