thlorenz / find-parent-dir

Finds the first parent directory that contains a given file or directory.
MIT License
24 stars 8 forks source link

(node:20744) [DEP0128] DeprecationWarning: Invalid 'main' field in '/usr/local/lib/node_modules/npm-check/node_modules/find-parent-dir/package.json' of 'find-parent-dir.js'. Please either fix that or report it to the module author (Use `node --trace-deprecation ...` to show where the warning was created) #8

Open Nastras opened 3 years ago

Nastras commented 3 years ago

Hello, I get this error displayed since the update from Node 14.x.x to Node 16.13.0

Do you have any idea why?

(node:20744) [DEP0128] DeprecationWarning: Invalid 'main' field in '/usr/local/lib/node_modules/npm-check/node_modules/find-parent-dir/package.json' of 'find-parent-dir.js'. Please either fix that or report it to the module author (Use node --trace-deprecation ... to show where the warning was created)

Thank you!

Nastras commented 3 years ago

I could eliminate the error message now in that I under: '/usr/local/lib/node_modules/npm-check/node_modules/find-parent-dir/package.json'

deleted this entry: "main": "find-parent-dir.js",

antongolub commented 2 years ago

@Nastras,

The mentioned issue was fixed in v0.3.1. But many dependent packages still require v0.3.0 image

wireless25 commented 2 years ago

For any devs stumbling over this, I solved it by updating to version 0.3.1. As this package is not a direct dependency of my project but used by some dependency I use, I had to install it explicitly in the project.

yarn add -D find-parent-dir@latest

Then use the resolutions field in the package.json file to force all dependencies to use this latest package version.

"resolutions": {
  "find-parent-dir": "^0.3.1"
}

Then reinstall the dependencies.

yarn install --force

Important for npm users

If you use npm instead of yarn, you need to install the package npm-force-resolutions first, as resolutions are not supported out-of-the-box.

npm install npm-force-resolutions

The rest is the same as explained above.