Skip to content
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

Incorrect update hint for global installs #279

Closed
piejanssens opened this issue Sep 15, 2020 · 12 comments
Closed

Incorrect update hint for global installs #279

piejanssens opened this issue Sep 15, 2020 · 12 comments
Assignees
Labels
bug Something isn't working module/ui5-cli Related to the UI5 CLI module

Comments

@piejanssens
Copy link

➜  ~ ui5 --version
1.13.1 (from /home/linuxbrew/.linuxbrew/lib/node_modules/@ui5/cli/bin/ui5.js)


   ╭──────────────────────────────────────╮
   │                                      │
   │   Update available 1.13.1 → 2.4.4    │
   │     Run npm i @ui5/cli to update     │
   │                                      │
   ╰──────────────────────────────────────╯
  1. installed globally (missing -g)
  2. major version update requires explicit major version to be specified. see https://docs.npmjs.com/cli-commands/update.html#updating-globally-installed-packages

FYI npm i -g @ui5/cli@latest doesn't upgrade a major version either. npm i -g @ui5/cli 2 will update to latest (2.4.4).

@RandomByte
Copy link
Member

Hey, could you please share your Node.js and npm versions?

We use update-notifier for this, which I think should handle this correctly already. @ui5/cli v1.13.1 used v4.0.0 of that module.

@piejanssens
Copy link
Author

➜  ~ npm --version
6.13.4
➜  ~ node --version
v12.15.0

@matz3
Copy link
Member

matz3 commented Sep 15, 2020

Could you please try to run this and post the printed result?

cd /home/linuxbrew/.linuxbrew/lib/node_modules/@ui5/cli
node -p "require(\"global-dirs\")"

It should log the paths which are used to detect whether the package is installed globally.
Maybe this differs within your setup. I wasn't able to reproduce this with the same CLI version.

@piejanssens
Copy link
Author

➜  ~ cd /home/linuxbrew/.linuxbrew/lib/node_modules/@ui5/cli
➜  cli node -p "require(\"global-dirs\")"
{
  npm: {
    prefix: '/home/linuxbrew/.linuxbrew/Cellar/node@12/12.15.0',
    packages: '/home/linuxbrew/.linuxbrew/Cellar/node@12/12.15.0/lib/node_modules',
    binaries: '/home/linuxbrew/.linuxbrew/Cellar/node@12/12.15.0/bin'
  },
  yarn: {
    prefix: '/home/linuxbrew/.linuxbrew/Cellar/node@12/12.15.0',
    packages: '/home/linuxbrew/.linuxbrew/Cellar/node@12/12.15.0/global/node_modules',
    binaries: '/home/linuxbrew/.linuxbrew/Cellar/node@12/12.15.0/global/node_modules/.bin'
  }
}

@matz3
Copy link
Member

matz3 commented Sep 16, 2020

That looks fine and the check should detect that the module is installed globally.

Could you please give some more details to allow us reproducing this on our side?
Which linux distribution do you use and how (native / Docker / WSL / ...)?
I was unable to reproduce this with the docker image node:12.15.0.

Regarding your second point about major updates:
I could not completely verify that.
When doing npm i -g @ui5/cli@1.13.1 and then npm i -g @ui5/cli (as suggested by the hint if it works correctly) I will get version 2.4.4, as expected.

@piejanssens
Copy link
Author

piejanssens commented Sep 16, 2020

WSL with Ubuntu 18.04

@matz3
Copy link
Member

matz3 commented Sep 17, 2020

Thanks, I'll try to reproduce the issue there.

@matz3 matz3 self-assigned this Sep 17, 2020
@piejanssens
Copy link
Author

I went back to 1.13.1 by doing npm -g uninstall @ui5/cli then npm i -g @ui5/cli@1.13.1 and it's no longer showing the update hint:

➜  ~ npm i -g @ui5/cli@1.13.1                                                                                                                                           
/home/linuxbrew/.linuxbrew/bin/ui5 -> /home/linuxbrew/.linuxbrew/lib/node_modules/@ui5/cli/bin/ui5.js                                                                   
                                                                                                                                                                        
> core-js@2.6.11 postinstall /home/linuxbrew/.linuxbrew/lib/node_modules/@ui5/cli/node_modules/core-js                                                                  
> node -e "try{require('./postinstall')}catch(e){}"                                                                                                                     
                                                                                                                                                                        
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!                                                        
                                                                                                                                                                        
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:                                                                       
> https://opencollective.com/core-js                                                                                                                                    
> https://www.patreon.com/zloirock                                                                                                                                      
                                                                                                                                                                        
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)                                                                                
                                                                                                                                                                        
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/@ui5/cli/node_modules/fsevents):                                                           
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})       
                                                                                                                                                                        
+ @ui5/cli@1.13.1                                                                                                                                                       
added 960 packages from 867 contributors in 51.93s                                                                                                                      
➜  ~ ui5 --version                                                                                                                                                      
1.13.1 (from /home/linuxbrew/.linuxbrew/lib/node_modules/@ui5/cli/bin/ui5.js)                                                                                           
➜  ~                                                                                                                                                                    

In addition, this time when I follow this with npm i -g @ui5/cli as you did it also installs 2.4.4... 😕

@RandomByte
Copy link
Member

it's no longer showing the update hint

There's a delay of 24 hours from detection until the update hint is displayed: https://github.com/yeoman/update-notifier#how

@matz3
Copy link
Member

matz3 commented Sep 21, 2020

I could reproduce the issue with Ubuntu 18.04 on WSL.
It seems to be related to the homebrew installation and how the "global-dirs" package resolves the paths.
The result above is in fact not correct as /home/linuxbrew/.linuxbrew/Cellar/node@12/12.15.0/lib/node_modules (from global-dirs) and /home/linuxbrew/.linuxbrew/lib/node_modules (where the global packages are installed to) are different folders which is the reason why the global check fails.

I'll collect all details to open an issue in global-dirs, as this is a general problem, not related to our CLI.

Update:
It's specific to the homebrew formula node@12. With the default node (which currently installs node v14), there are no issues.

@piejanssens
Copy link
Author

@matz3 Nice find!

@matz3
Copy link
Member

matz3 commented Sep 22, 2020

Closing this issue, please see sindresorhus/global-directory#17 for further progress

@matz3 matz3 closed this as completed Sep 22, 2020
@RandomByte RandomByte transferred this issue from SAP/ui5-cli Nov 19, 2020
@RandomByte RandomByte added bug Something isn't working module/ui5-cli Related to the UI5 CLI module labels Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module/ui5-cli Related to the UI5 CLI module
Projects
None yet
Development

No branches or pull requests

3 participants