Comments (6)
@JalexChen Does this work for us or does it contradict the recent recommendation we had of not using sudo
?
from cimg-node.
use cases of symlinking to /usr/local/bin
shouldn't be limited to sudo
in my opinion.
one example, entering with different shell than bash.
from cimg-node.
The symlink was utilized before in #236 but was removed at some point. IIRC it was because of attempting to use $PREFIX with workspaces and we thought it was an issue with nvm, but there is nothing wrong with the symlink.
@felicianotech i think the issue with using sudo was with npm. I think implementing the symlink for node doesn't hurt, but you shouldn't need to use sudo at all when using nvm. @ryuheechul, is there a specific reason you need this?
from cimg-node.
@JalexChen thanks for your reply and explanation and here are my response to that.
you shouldn't need to use sudo at all when using nvm
I agree that it's a good practice but the image shouldn't make the decision for users on that. Also some script might need sudo
and npm
at the same time and it might natural to call that script like below
$ cat <<EOF> script-that-needs-sudo.sh
command-that-fail-if-not-sudo
npm ...
node ...
EOF
# this will fail to find `node` and `npm`
$ sudo script-that-needs-sudo.sh
Although the better version for it should be like below, there is no guarantee that every one write like this including potential third party or unfamiliar dependencies.
$ cat <<EOF> script-that-needs-sudo-only-for-certain-commands.sh
sudo command-that-fail-if-not-sudo
npm ...
node ...
EOF
$ script-that-needs-sudo-only-for-certain-commands.sh
is there a specific reason you need this?
Yes. The specific reason for me: node
, npm
to be discoverable from any shell not just from bash, and even when there is no additional path is added to $PATH
. Using sudo
happen to fall in category.
I personally avoid using sudo
as much as possible, but that might not be the case for others in a team.
I think these reasons alone are good enough to justify enabling this capability:
node
andnpm
was under/usr/local/bin/
from17.*
images- installing node in "regular" way result in binary discoverable under
/usr/local/bin/
- official node image binaries are under
/usr/local/bin/
and it's reasonable for people to expect the similarity between the official node image andcimg/node
$ docker run --rm -it node:18-slim bash root@4afe58bcb460:/# which node /usr/local/bin/node root@4afe58bcb460:/# which npm /usr/local/bin/npm
Otherwise, people might just run commands like below (or whatever other hacks) themselves at some point in the CircleCI steps and feel that the image is "not that convenient".
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"
from cimg-node.
hey @ryuheechul - i think these are all valid and after deliberation, we've decided to move away from nvm, especially since the cimg's should still be deterministic and reflect one specific version of node. We'll be re-implementing this shortly and sudo functionality will point to the node and npm versions in /usr/local/bin
from cimg-node.
Hi @JalexChen, sounds good to hear and moving away from nvm
seems to be the right choice ππΌ.
Thanks a lot for the update!
from cimg-node.
Related Issues (20)
- Latest version of image run out of memory HOT 2
- Recent versions of image cause jest to fail HOT 1
- permissions on node 16:17 HOT 1
- Using the image in other CI tools HOT 3
- shallow checkout HOT 5
- /home/circleci/.local/bin is in path but doesnβt exist by default HOT 2
- Can you create this image please? HOT 1
- Publish major version (only) tag pointing at the latest build for a major node version HOT 1
- Base Ubuntu version changing HOT 2
- cimg/node:16.18 & cimg/node:16.19: "Mongod instance closed with code \"127\"" was thrown, throw an Error :) HOT 2
- Migrating from circleci/node:16.13-browsers to cimg/node:16-13 HOT 2
- Feature Request: Update open JDK to the next LTS HOT 4
- Feature Request: Include Bun (bun install) HOT 1
- Bug Report: Missing Node.js 20.6.1 release
- Feature Request: cimg/node browsers arm64 support HOT 2
- Bug Report: wrong LTS version HOT 3
- Feature Request: Update open JDK in -browsers image to the next LTS (17)
- Bug Report: automated-wf is broken
- Feature Request: variant with browsers and test drivers preinstalled
- Feature Request: February Node security releases HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cimg-node.