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

NPM installation on Ubuntu requires sudo #14673

Merged
merged 3 commits into from
Apr 11, 2022

Conversation

hamishwillee
Copy link
Collaborator

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 the H or i 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.

@hamishwillee hamishwillee requested a review from a team as a code owner April 4, 2022 23:10
@hamishwillee hamishwillee requested review from ddbeck and removed request for a team April 4, 2022 23:10
@github-actions github-actions bot added the Content:Learn Learning area docs label Apr 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2022

Preview URLs

Flaws

None! 🎉

External URLs

URL: /en-US/docs/Learn/Tools_and_testing/Understanding_client-side_tools/Command_line
Title: Command line crash course
on GitHub

(this comment was updated 2022-04-11 00:43:51.050490)

Copy link
Collaborator

@wbamberg wbamberg left a 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.

@wbamberg
Copy link
Collaborator

wbamberg commented Apr 5, 2022

Or we could even, at this point, only just mention global install, and not make such a big thing of it.

sideshowbarker
sideshowbarker previously approved these changes Apr 5, 2022
@hamishwillee
Copy link
Collaborator Author

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
Copy link
Collaborator

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.)

Copy link
Collaborator Author

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
Copy link
Collaborator

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.)

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you Hamish!

@wbamberg wbamberg merged commit 006cadd into mdn:main Apr 11, 2022
@hamishwillee hamishwillee deleted the command_line_sudo branch April 12, 2022 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Learn Learning area docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with "Command line crash course": (Prettier tool install error)
3 participants