-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False, ncu lies: "All global packages are up-to-date :)" is not true. #293
Comments
Hi! Thanks for reporting. It is likely that |
But what |
Ah, good point. I'm sorry I overlooked that. Are you using the normal child_process.exec? I can investigate more. It seems as if it's not running the global flag. |
It seems to be working as expected for me. Here are my results:
And then with this test file:
Results:
There must be some difference between your running it in the terminal and running it with child_process.exec. Can you do what I did above to compare the location of ncu and the npm prefix between your terminal and the executing node process? Post the results here. If there is a difference, that could give us a clue into the differing behavior. If they are the same, we will have to get more creative :). |
This also occurs if you type |
If you're able to run the commands above to check the prefix locations, I can try to troubleshoot more. Thanks! |
Closing due to no activity, but let me know if the issue is still unresolved! |
@raineorshine , same problem for me under Ubuntu:
|
@borgogelli Thanks for reporting. Can you execute this code and share the results? That might help me troubleshoot.
|
The output is:
(same output for user and sudo) |
It must be something other than the prefix. I am afraid I don't know how to reproduce the problem. It will require someone who is able to reproduce the problem to go into the npm-check-updates module code to troubleshoot. |
I seem to be having a similar issue in Windows.
And then:
It seems to me that ncu is reading the wrong npm list.
and I think that ncu is checking the roaming profile ( |
After reading the two threads carefully, I got it to work like this: |
@digeomel Glad you found a solution! I'm sure it would be a simple fix, just need someone to be generous enough to find the issue in the codebase since I am unable to reproduce it on my end. |
I've forked the repo and debugged it. I traced it down to this line: Now, the question is why? PS. And on another peculiar note, what is that |
Thank you for the sleuthing @digeomel! That line was added by @anantoghosh in 9be7b2f as described here. It seems to be related to ncu's legacy use of |
I removed it and published on the
|
@raineorshine thank you for the quick response! 😄 On another note which I forgot to mention earlier, during my debugging I discovered that this |
console.log(require('libnpmconfig').read())
...
FiggyPudding {
cache: '/Users/raine/.npm',
loglevel: 'warn',
'@bit:registry': 'https://node.bit.dev',
configNames: [ 'npmrc', '.npmrc' ],
envPrefix: /^npm_config_/i,
cwd: '/Users/raine/projects/npm-check-updates',
globalconfig: '/Users/raine/.nvm/versions/node/v12.13.0/etc/npmrc',
userconfig: '/Users/raine/.npmrc'
} |
@raineorshine this does on my machine:
But I guess it does because it is explicitly set in my .npmrc. In your case you probably have none specified, so it gets the default. How about importing npm as a dependency and doing something like this:
|
We could always start with
Last I knew requiring |
I think your solution of using zkat/pacote#156 In any case, thank you for your support! 👍 |
@digeomel Thanks for your help! Any interest in making a PR for this? Should be a very small change. |
Sure, I'll give it a try over the weekend! |
|
So the actual logic to get the global prefix appears to be this. It depends on |
@stoically The problem I see with the code snippet from your link above:
is that |
|
Then it doesn't make sense, because on win32 it will just pick the directory where node is installed. |
It's the npm default, so I guess it should work by default. But sure, a prefix configured in a .npmrc should take precedence over the default detection. |
But there is no reading of .npmrc on the code above. So we're missing something. |
The code there only sets the defaults, that's why the variable it's assigned to is called |
However, just checking libnpmconfig for prefix and falling back to spawning npm like it's already done would be equally fine for me personally. Just wanted to point out that it could be avoided. |
Similar to #1127 |
Closing due to inactivity, but please let me know if this still an issue and we have a way to move forward on it. |
If I use:
ncu -g
it sasys to me:If I use in my gulpfile.js this:
it says to me:
Why this behaviour?
Windows 10 x64
NodeJs 7.1.0
The text was updated successfully, but these errors were encountered: