-
Notifications
You must be signed in to change notification settings - Fork 22.4k
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
NPM installation on Ubuntu requires sudo #14673
Conversation
files/en-us/learn/tools_and_testing/understanding_client-side_tools/command_line/index.md
Outdated
Show resolved
Hide resolved
files/en-us/learn/tools_and_testing/understanding_client-side_tools/command_line/index.md
Show resolved
Hide resolved
Preview URLsFlawsNone! 🎉 External URLsURL:
(this comment was updated 2022-04-11 00:43:51.050490) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will get in trouble for this, possibly righteously.
Since we already say local installation is usually better, and we cover that anyway in the next article, why not make this article also use local installation?
npm install prettier
npx prettier
(we would have to explain a bit about npx
)
We should still include permissions issues as a con about global install.
Or we could even, at this point, only just mention global install, and not make such a big thing of it. |
After much thought I have decided to make this install locally. The main reason being that this is what prettier.io itself recommends. Given that, I have also pointed to their installation instructions. FWIW I would have been happy to live with the disappointment of the Linux community. Can you guys please re-review, |
|
||
Running the command without any arguments, as with many other commands, will offer up usage and help information. Try this now: | ||
```bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably gets to 'what is the point of this article anyway' but you don't actually need the .prettierrc.json
or .prettierignore
stuff just to play with Prettier, which was all the previous version of the article was showing. And I'm not sure what --save-dev
and --save-exact
will do for you outside the context of package.json.
So I would prefer that we leave them out of this, and just do:
npm install prettier
(But if you still want to include that extra stuff I'm OK with that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't even really think about it - still grinding my teeth over global install.
On balance I agree so have removed both. Thanks.
|
||
Running the command without any arguments, as with many other commands, will offer up usage and help information. Try this now: | ||
```bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably gets to 'what is the point of this article anyway' but you don't actually need the .prettierrc.json
or .prettierignore
stuff just to play with Prettier, which was all the previous version of the article was showing. And I'm not sure what --save-dev
and --save-exact
will do for you outside the context of package.json.
So I would prefer that we leave them out of this, and just do:
npm install prettier
(But if you still want to include that extra stuff I'm OK with that.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thank you Hamish!
Fixes #14558
Generally Ubuntu/Linux users have a tantrum when you suggest using
sudo
to resolve permission errors. However this is "Learn" content, and if we want users to be able to follow it then we can't expect Linux expertise. From my research using sudo with NPM is actually recommended, in particular if you use theH
ori
flags to make sure that the files are installed to correct locations for current user.Upshot, I think this is OK with a caveat "there are monsters here".
I have highlighted the specific relevant changes with inline comments.