Community Packages

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#72937 - [npm-check-updates] ncu cannot find it's own package.json

Attached to Project: Community Packages
Opened by Yichao Yu (yuyichao) - Monday, 06 December 2021, 13:06 GMT
Last edited by Andreas Radke (AndyRTR) - Tuesday, 07 December 2021, 10:21 GMT
Task Type Bug Report
Category Packages
Status Assigned
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No



When running `ncu`, it throws an error
throw err;

Error: Cannot find module '../../package.json'
Require stack:
- /usr/lib/node_modules/npm-check-updates/build/src/bin/cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/usr/lib/node_modules/npm-check-updates/build/src/bin/cli.js:11:40)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
requireStack: [ '/usr/lib/node_modules/npm-check-updates/build/src/bin/cli.js' ]

Node.js v17.1.0

It appears that it's trying to find it's own package.json file using a relative path. In the repo and source tarball, `cli.{ts,js}` is `src/bin/` but in the package this is `build/src/bin` causing the relative path to be different. Copying the packages.json into the `build` directory fixes the problem but I don't know what's the correct fix....

Additional info:
* package version(s) 12.0.2
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
Just run `ncu` command.
This task depends upon