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

"n lts" downgrading npm version 6.10.1 to 6.9.0 #574

Closed
pdh0710 opened this issue Jul 20, 2019 · 7 comments
Closed

"n lts" downgrading npm version 6.10.1 to 6.9.0 #574

pdh0710 opened this issue Jul 20, 2019 · 7 comments

Comments

@pdh0710
Copy link

pdh0710 commented Jul 20, 2019

Bug Report

Summary

(Please excuse my English)

  • I'm using node.js LTS version ( by executing n lts )
    Currently node.js LTS version is v10.16.0.
  • I manually upgrade npm to version 6.10.1 ( by executing npm -g install npm )

I just upgraded 'n' to version 5.0.1, execute n lts, and I found that 'npm' version was downgraded from 6.10.1 to 6.9.0.

At first, I did not know why. But, through the iterative test, I could found that executing n lts cause the problem. Finally I found that node.js@10.16.0 is repeatedly installed when I execute n lts.

Additionally, I found that the installation paths of node.js and global modules were changed from ['/usr/bin/node', '/usr/lib/node_modules'] to ['/usr/local/bin/node', '/usr/local/lib/node_modules']. I do not know the reason. But, I re-installed node.js global modules for safety. So two node.js('/usr/bin/node' and '/usr/local/bin/node', all v10.16.0) are installed in my system, currently.

Previous version of 'n' did not make these problems, so I think this is a newly appeared bug.

My system informations

$ n --version
5.0.1

$ node -v
v10.16.0

$ which node
/usr/local/bin/node

$ npm root -g
/usr/local/lib/node_modules

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:        18.04
Codename:       bionic

$ uname -a
Linux server 4.15.0-54-generic #58-Ubuntu SMP Mon Jun 24 10:55:24 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
@shadowspawn
Copy link
Collaborator

What has changed in n v5.0.0 is that when you run n its it now always does an install so you get consistent behaviour. Previously, if the active version of node was already the lts version then n would silently skip the install.

The install includes both node and npm. This can mean a downgrade of npm if you separately updated npm separately in the default install location. (You could change the npm prefix if you want to manage it yourself.)

The default install location used by n is to /usr/local. The other location you see will be installed by the Ubuntu package manager. It is confusing having two versions installed, so if you are going to use n and install to /usr/local then you might want to delete the "other" ones.

@pdh0710
Copy link
Author

pdh0710 commented Jul 20, 2019

@shadowspawn You meant that it's not a new bug, but new feature, right? I do not know why the new feature was adopted. However, if 'n' changes the installation path or re-installs the same version repeatedly, it would be better to notify to the user.

@shadowspawn
Copy link
Collaborator

You meant that it's not a new bug, but new feature, right?

I mean two things you saw were the same in the previous version. When n installs node it also installs npm. n installs to /usr/local by default.

I do not know why the new feature was adopted.

See #543 if interested.

@pdh0710
Copy link
Author

pdh0710 commented Jul 20, 2019

@shadowspawn I'm using 'npm-check' to auto-update node modules. I don't know why 'npm-check' updates 'n@5.0.*' today.

It is not important in which version the new feature was adopted. Anyway, the newly installed 'n' changes the installation path of my node.js and re-installs my node.js repeatedly, without notice. So, I and my system have been in confusion.
I remember that 'n' changed the function of the 'stable' option a few months ago, also without notice. It also had put me and my system in confusion.

It is good to introduce new features and functions to enhance a software. However, it would be better to respect the backward compatibility and the user choice whether or not use new features and functions. You should remember : Though it may be a bad feature, many users are using the feature.

@shadowspawn
Copy link
Collaborator

I am sorry you and your system were in confusion. Hopefully you are clearer how it works now.

@shadowspawn
Copy link
Collaborator

To make this clearer I am adding the npm version to the install logging in v6.

Prerelease available via npm i n@next for v6. Release notes: https://github.com/tj/n/releases/tag/6.0.0-0

@shadowspawn
Copy link
Collaborator

Added npm version to install logging in v6: https://github.com/tj/n/releases/tag/v6.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants