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

Instruct user to use npx in home page #797

Merged
merged 1 commit into from Feb 17, 2022
Merged

Conversation

Flimm
Copy link
Contributor

@Flimm Flimm commented Sep 28, 2020

This command fails on some systems:

npm install -g @11ty/eleventy

For instance, on Ubuntu 20.04 LTS, it fails with this error message:

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'

These are instructions on how to start quickly... Let's use npx the way it was intended to be used. This matches documentation in other places.

This command fails on some systems:

npm install -g @11ty/eleventy

For instance, on Ubuntu 20.04 LTS, it fails with this error message:

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'

These are instructions on how to start quickly... Let's use npx the way it was intended to be used. This matches documentation in other places.
@binyamin
Copy link
Member

@Flimm On ubuntu, you should probably use sudo

@Flimm
Copy link
Contributor Author

Flimm commented Sep 30, 2020

Even on Ubuntu, you might be using a user account without sudo privileges. I like my pull request better, as it works for all operating systems, whether the user is an administrator or not, and it matches documentation in other places. The only requirement is that Node is installed.

@binyamin
Copy link
Member

Good point

@Ryuno-Ki
Copy link
Contributor

I'd advise against global installation of Node packages. Imagine, you want to use different versions in different projects?
You can't! Instead, install it locally and either define a NPM run-script or add it to PATH.

For example, on Ubuntu, you could create a directory $HOME/bin, install Node packages there locally and add $HOME/bin/node_modules/.bin to $PATH.

@Flimm
Copy link
Contributor Author

Flimm commented Oct 13, 2020

I'd advise against global installation of Node packages. Imagine, you want to use different versions in different projects?
You can't! Instead, install it locally and either define a NPM run-script or add it to PATH.

Just to be clear: the current instructions on the home page do advise global installation, but the fix in this pull request does not. I agree that global installation is bad, which is why I removed that in the pull request.

My pull request allows you to install different versions for different projects, without having to define an NPM run-script or add it to the PATH. This is because npx looks in node_modules for the package before it looks anywhere else, and the instructions as written in the pull request instruct the user to run npm install @11ty/eleventy first. This matches other eleventy documentation.

@Ryuno-Ki
Copy link
Contributor

My comment was aimed at @binyamin :-)

Thanks for your effort, @Flimm :-)

@zachleat
Copy link
Member

Ooh I like this change a lot.

I do wonder if these npm WARNs would be confusing to people though:

npm WARN saveError ENOENT: no such file or directory, open '/Users/zachleat/Temp/eleventy-test-npx/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/zachleat/Temp/eleventy-test-npx/package.json'
npm WARN eleventy-test-npx No description
npm WARN eleventy-test-npx No repository field.
npm WARN eleventy-test-npx No README data
npm WARN eleventy-test-npx No license field.

@tannerdolby
Copy link
Contributor

If you run npm init -y and generate a default package.json before running the install will the same npm WARN errors be thrown?

@zachleat
Copy link
Member

Finally coming back to this one—super on board, seems like the npm stuff has been smoothed out a bit too. Here’s what I see running this now:

~/Temp/eleventy-website-797 ᐅ npx @11ty/eleventy
Need to install the following packages:
  @11ty/eleventy
Ok to proceed? (y) y
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
[11ty] Writing _site/test/index.html from ./test.md (liquid)
[11ty] Wrote 1 file in 0.03 seconds (v1.0.0)

Those warnings are from browser-sync (and notably also happen on global installation too). Follow along for those at 11ty/eleventy#2213

@zachleat zachleat merged commit 7706261 into 11ty:master Feb 17, 2022
@zachleat
Copy link
Member

🚢🛳⛴🚀📦

@zachleat zachleat self-assigned this Feb 17, 2022
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

Successfully merging this pull request may close these issues.

None yet

5 participants