nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.55k stars 2.35k forks source link

[DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead. #26904

Closed patrickhammond closed 1 month ago

patrickhammond commented 3 months ago

Current Behavior

When using Node 22.x, some nx commands that use the run-many option show this warning. Ex: nx run-many -t serve. Running the same command against a specific app does not show the warning. Ex: nx serve app.

(node:77945) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Documentation on the warning: https://nodejs.org/docs/latest-v22.x/api/deprecations.html#DEP0060

Expected Behavior

nx commands that result in forked processes should be able to be run without warnings.

GitHub Repo

No response

Steps to Reproduce

  1. Use any version of Node 22.x.
  2. Use any recent version of nx with a simple Fastify server.
  3. Start up a server using nx run-many -t serve
  4. Observe the displayed deprecation warning.

Nx Report

NX   Report complete - copy this into the issue template

Node   : 22.4.1
OS     : linux-arm64
npm    : 10.8.1

nx                 : 19.4.2
@nx/js             : 19.4.2
@nx/jest           : 19.4.2
@nx/linter         : 19.4.2
@nx/eslint         : 19.4.2
@nx/workspace      : 19.4.2
@nx/devkit         : 19.4.2
@nx/esbuild        : 19.4.2
@nx/eslint-plugin  : 19.4.2
@nx/node           : 19.4.2
@nrwl/tao          : 19.4.2
typescript         : 5.5.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

Running node --trace-warnings node_modules/.bin/nx run-many -t serve to trace out the source of the warning shows this:

(node:74883) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
    at Logger (/project/node_modules/strong-log-transformer/lib/logger.js:32:18)
    at /project/node_modules/nx/src/tasks-runner/forked-process-task-runner.js:219:39
    at new Promise (<anonymous>)
    at ForkedProcessTaskRunner.forkProcessWithPrefixAndNotTTY (/project/node_modules/nx/src/tasks-runner/forked-process-task-runner.js:181:16)
    at ForkedProcessTaskRunner.forkProcess (/project/node_modules/nx/src/tasks-runner/forked-process-task-runner.js:119:25)
    at TaskOrchestrator.runTaskInForkedProcess (/project/node_modules/nx/src/tasks-runner/task-orchestrator.js:286:54)
    at TaskOrchestrator.applyFromCacheOrRunTask (/project/node_modules/nx/src/tasks-runner/task-orchestrator.js:269:61)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async TaskOrchestrator.executeNextBatchOfTasksUsingTaskSchedule (/project/node_modules/nx/src/tasks-runner/task-orchestrator.js:77:13)
    at async Promise.all (index 0)

The strong-log-transformer dependency is coming from: https://github.com/nrwl/nx/blob/2c4c2ae8ca525b973df97b4d8721709b481ad027/packages/nx/package.json#L65

This appears to be its only usage in nx: https://github.com/nrwl/nx/blob/2c4c2ae8ca525b973df97b4d8721709b481ad027/packages/nx/src/tasks-runner/forked-process-task-runner.ts#L4

Yberion commented 2 months ago

Same problem

plaskowski-bqs commented 2 months ago

In newest version still appear... This strong-log-transformer lib is not updated from 2018... but somebody prepared a fix, which waiting to CR...

guiseek commented 1 month ago

the same thing happens here

MacFinter commented 1 month ago

actual for me (node:59326) [DEP0060] DeprecationWarning: The util._extend API is deprecated. Please use Object.assign() instead.

saeidi-dev commented 1 month ago

I have this problem

(node:21492) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Yaoghost commented 1 month ago

Has anybody found a solution?

bkhtbkid commented 1 month ago

I had this error. I changed the node version to a lower version and everything worked

xiongemi commented 1 month ago

as mentioned above, it is caused by https://github.com/strongloop/strong-log-transformer/issues/12. need to wait for strong-log-transformer to update

xiongemi commented 1 month ago

i submitted a pr to remove package strong-long-transfromer from nx's package's dependencies

whs0809 commented 2 weeks ago

My node version 22.2 reported this error, I reduced the node version to 18.20 and started again to solve the problem.Should be too high version caused by incompatibility?