package.json is not enough

  Рет қаралды 53,458

Hussein Nasser

Hussein Nasser

Күн бұрын

Пікірлер: 127
@hnasr
@hnasr 2 жыл бұрын
Head to database.husseinnasser.com for a discount coupon to my Introduction to Database Engineering course. Link redirects to udemy with coupon applied.
@ShamilSattarov
@ShamilSattarov 2 жыл бұрын
Some people think that 'npm ci' stands for "continious integration" because it mostly appears in CI build scripts. But actually it stands for "clean install". Your welcome!
@amoodaa
@amoodaa 2 жыл бұрын
Its not clean install, its simply used more in continuous integrations environments, yes it does a clean install, but its a clean install because your CI will always be a new "instance", but it also adheres strictly to the package-lock dependency versions, unlike npm install
@KingTheRat
@KingTheRat 2 жыл бұрын
Just run "npm ci -h" and you will see what it is. npm ci Install a project with a clean slate Usage: npm ci Options: [--no-audit] [--ignore-scripts] [--script-shell ] aliases: clean-install, ic, install-clean, isntall-clean Run "npm help ci" for more info
@davisdimalen3912
@davisdimalen3912 2 жыл бұрын
@@KingTheRat Ah the wonders of the internet. :) Thanks for this valuable information.
@flannelbeard4621
@flannelbeard4621 2 жыл бұрын
... who tf assumed it meant "continuous integration"? No real developer would think that. Seriously. That's ridiculous.
@mayursinhsarvaiya9302
@mayursinhsarvaiya9302 2 жыл бұрын
@@flannelbeard4621 Me. I assumed it as continuous integration, seriously.
@TomDoesTech
@TomDoesTech 2 жыл бұрын
Great video. One command that I use to debug my packages is npm why or yarn why, shows you the dependancy graph for a given dependancy, so you can see why it was installed.
@sidwebworks9871
@sidwebworks9871 2 жыл бұрын
I see you've reached to this video even before me 😂
@RyanKOnk
@RyanKOnk 2 жыл бұрын
I watch your videos here and there. Good content
@TomDoesTech
@TomDoesTech 2 жыл бұрын
@@sidwebworks9871 You've got to be quick!
@ADPenrose
@ADPenrose 8 ай бұрын
I spent months reading articles and watching videos, and none of it stuck. Hands down, the best explanation on the topic. You're doing God's work here mate!
@chungweileong
@chungweileong 2 жыл бұрын
This is definitely a good explanation! It’s frustrating when someone posted a solution for dependency related issue by removing the lock file, it get even worst especially when a package author decided to push a breaking change as a minor update.
@ss-gc9qq
@ss-gc9qq 2 жыл бұрын
I've come across this explanation before, but it never quite stuck. I appreciate your communication style, thanks!
@yadneshkhode3091
@yadneshkhode3091 2 жыл бұрын
Thank you 💗💗😊😊 sir because of your videos i am learning a lot recently I received 150% hike as Backend developer this had a positive impact on me and my family ❤️❤️ Thank you once again
@sunjayarmstead
@sunjayarmstead 2 жыл бұрын
Congrats to you! I too recently got a pay hike. Feels really validating.
@SimonChikezie
@SimonChikezie 8 ай бұрын
thanks bro now i can never forget the difference
@anantharao2310
@anantharao2310 8 ай бұрын
Hi. That was great explaination between package.json and package-lock.json files. Well done.
@thetrends5670
@thetrends5670 2 жыл бұрын
"Keep the major version out of your f***ing mouth" - Nasser 2022
@zeroww7
@zeroww7 2 жыл бұрын
will-package-smith @4:04 reporting for slapping
@dr_davinci
@dr_davinci 2 жыл бұрын
omg ! I didn't get the reference until I read your comment , and for that I thank you.
@anupamchakrawarti1803
@anupamchakrawarti1803 2 жыл бұрын
Nicely explained, for the longest time I had doubts what the heck is package-lock.json or the yarn counterpart. Last week, I took some time to clear these doubts, good now. This video is now on my references list. And yes, English is hard 😢
@sunjayarmstead
@sunjayarmstead 2 жыл бұрын
Hussein, this video is gold! Really well explained. I didn’t know about ‘npm ci’ - how handy! 👍🏽🔥
@ericjing3138
@ericjing3138 Жыл бұрын
The best one I've ever seen on this topic..Thanks.
@sujeethes6534
@sujeethes6534 2 жыл бұрын
Thanks for adding humour in teaching
@bashar876
@bashar876 2 жыл бұрын
Thank you!!!!!! Super clear explanation. Please do one on peer dependencies in package lock json if you get the time and interest ❤️
@PenguinjitsuX
@PenguinjitsuX 2 жыл бұрын
LOOL 4:03 "Keep the major version out of your F** mouth!" that made me laugh so hard
@rituagrawal2218
@rituagrawal2218 2 жыл бұрын
Man you are awesome. You explain engineering concept so well.
@ngoako
@ngoako 2 жыл бұрын
Good refresher 👌 I read somewhere that the ci stands for clean install?
@orzumirzayev6630
@orzumirzayev6630 2 жыл бұрын
Hello Husein. Thanks for video. I learned a lot from this. I really appreciate what you are sharing us.
@SwapnilSoni
@SwapnilSoni 2 жыл бұрын
Computer: knows 0 and 1 Hussein sir: **pathetic**
@syedb8943
@syedb8943 2 жыл бұрын
Thanks Hussein for covering this topic !
@harshitjoshi3082
@harshitjoshi3082 2 жыл бұрын
Ah that's the reason why everytime I contribute to a nodejs codebase, the package-lock.json changes appears in my commits ! Thanks for the video, Great content 🔥
@redaawwad3544
@redaawwad3544 2 жыл бұрын
Thank you Hussein, happy Ramadan bro. 🌹🌹
@AzedineOuhadou
@AzedineOuhadou 9 ай бұрын
great explanation Nasser.
@justaguyt
@justaguyt 2 жыл бұрын
Thanks very much, 😭😭 these are the kind of explanation that help in building CI CD pipelines And for sure JavaScript project pipelines are hard to maintain
@jupyter5k647
@jupyter5k647 2 жыл бұрын
Hussein if you work normally with node then I very highly recommend you to use another node package manager called "pnpm", it is far more efficient for managing depenedencies than just npm
@rocstar3000
@rocstar3000 2 жыл бұрын
I use yarn :)
@jupyter5k647
@jupyter5k647 2 жыл бұрын
@@rocstar3000 i've been using yarn since I started using nodejs for a long time and had been loving it, but after trying out pnpm I just switched as it has a really nifty way of managing your packages that I found is much better than yarn :^) Give it a go and see what you think about it ;^]
@Vietnamkid1993
@Vietnamkid1993 2 жыл бұрын
I recognized this name somewhere🤩Great nginx course on Udemy
@udaynarayanmukherjee5208
@udaynarayanmukherjee5208 2 жыл бұрын
npm ci thing ... super cool. Also, if you had just given the exact version to package.json you wouldn't have to deal with package lock. In bigger projects, resolving merge conflicts when upgrading multiple packages would be a headache. So, I would suggest use exacts and use ~ only when u know u wudbe okay with minor upgrades
@karim-gb5nx
@karim-gb5nx 2 жыл бұрын
i just subbed because you said "KEEP THE MAJOR VERSION OUT OF YOUR F*ING MOUNTH !"
@hotharvey2
@hotharvey2 2 жыл бұрын
it's "set IN stone" imagine carving INto a stone is more permanent than drawing ON a stone ;) thanks for the video
@pim8268
@pim8268 2 жыл бұрын
Great content! And also a touch of sense of humor. We need to add a little fun to our learning process.
@JohnDoe-bu3qp
@JohnDoe-bu3qp 2 жыл бұрын
In: there are fish in the sea. On: there are boats on the sea. Over: Most commercial aircraft fly over the clouds. Above: Satellites are way above the clouds. Under: You find all kinds of things lost under a sofa. Beneath: If you dig enough, you might find crude oil beneath the ocean floor.
@thiagoalmeida5437
@thiagoalmeida5437 2 жыл бұрын
Could we just not use ~ or ˆ in the package.json to lock the version?
@Abdullah-yq7jp
@Abdullah-yq7jp 2 жыл бұрын
Yes - but any vulnerability found, patched will remain in your code that can be exploited!!
@THEVIERAOS
@THEVIERAOS 2 жыл бұрын
@@Abdullah-yq7jp While true, it’s not a bad choice to lock your packages down to a version. Especially if consistency and application up time are a key priority. It adds the overhead of having to monitor for exploits one way or another but it also keeps potential breaking changes out of your code base. It all depends on the package and how big of an impact it has on your application of course.
@jeremiahblessing3891
@jeremiahblessing3891 2 жыл бұрын
Some where I read npm ci is for clean install, LOL!. Finally understood what that npm ci does. Gonna change my gitlab pipelines.
@martinmohammed4087
@martinmohammed4087 2 жыл бұрын
This video is different. But positive with much of humour. Thanks
@PhilipLon7
@PhilipLon7 2 жыл бұрын
What I don't understand is, why they built npm so that "install" updates the packages. In my opinion it would be far more intuitive if only "update" updated packages and the package-lock.json file and "install" (or "restore") was the "ci" equivalent
@leonbenjamin7891
@leonbenjamin7891 2 жыл бұрын
Finally got it...thanks :)
@paulsalele3844
@paulsalele3844 2 жыл бұрын
great explanations
@ramshankarkumar4222
@ramshankarkumar4222 2 жыл бұрын
Awesome explanation!!! Thank you so much for providing this knowledge.
@ambianceTree
@ambianceTree 9 ай бұрын
👍 Good simplification
@prakharvijay8853
@prakharvijay8853 2 жыл бұрын
great explanation, I had always wondered the utility of package-lock.json, now I know it
@uttammali1337
@uttammali1337 2 жыл бұрын
you can use "npm shrinkwrap'' it'll help you to lockdown the versions of installed packages and their descendant packaages.
@tonynguyen4007
@tonynguyen4007 2 жыл бұрын
Great explanation video as always Hussein. Love your video. But I fell weird with the example of why we need to use `npm ci` If the author of project need to stick to specific version, they would not add `~` -> anyone pull and install the project would not need to run `npm ci` they can just use `npm install` as usual Btw. `npm install` already gives preference `package-lock.json`. But yarn gives preference `package.json`
@kapahimself
@kapahimself 2 жыл бұрын
PLEASE START A DISCORD SERVER CAUSE YOUR CONTENT IS ABSOLUTE GOLD.
@lokeshpatel3914
@lokeshpatel3914 2 жыл бұрын
Great explanation. Please make a very detailed playlist of nodejs 🙏
@ManojKumar-eg2sp
@ManojKumar-eg2sp 2 жыл бұрын
We also have npm-shrinkwrap.json , when we run npm ci and if our project doesn't have package-lock.json, npm CI considers shrinkwrap.json
@yassdev
@yassdev Жыл бұрын
I think the CI in npm ci stands for "Current Install"
@dhillaz
@dhillaz 2 жыл бұрын
This whole time I have been deleting package-lock.json just because VS Code complains about it too much. 😂
@coreyfelipe5679
@coreyfelipe5679 2 жыл бұрын
Haha 😆. Have you considered doing podcast. You are funny and yet so knowledgeable to the topic.
@azeynar
@azeynar 2 жыл бұрын
Great explanation, thank you !!!
@shubhamnandeshwar999
@shubhamnandeshwar999 2 жыл бұрын
Amazing video! npm ci is actually clean install, it has nothing to do with CI/CD!
@MK-ef9iu
@MK-ef9iu 2 жыл бұрын
Very clear. Big up to Will smith
@coderinprocess2678
@coderinprocess2678 8 ай бұрын
Hey @hnasr, how to decide whether to use carrot or tilda ?
@HarshKapadia
@HarshKapadia 2 жыл бұрын
Good video. Thank you Hussein!
@williampogany6038
@williampogany6038 Жыл бұрын
great video and your english is good! :)
@andyk2181
@andyk2181 2 жыл бұрын
The docs for `npm update` explain how the semver in package.json is used. `npm install` will use package-lock.json if it's there *and compatible with `package.json`*, `npm ci` needs the lock file and will remove node_modules if that exists.
@unemployedcse3514
@unemployedcse3514 9 ай бұрын
Awesome ❤
@harishkanna6079
@harishkanna6079 9 ай бұрын
So should we always use npm ci all the time instead of npm install just to be safe??
@hemanthsubbiah6826
@hemanthsubbiah6826 2 жыл бұрын
Straight to my gitlab CI/CD codebase and updating all npm install commands to npm ci
@DerLuukee
@DerLuukee 2 жыл бұрын
"Don't touch my minor" 😂
@harshilparmar9076
@harshilparmar9076 2 жыл бұрын
This is gold 🥇
@thorfinnthegoatmc
@thorfinnthegoatmc 2 жыл бұрын
damn Im using npm for years now I didnt know `npm ci` existed until now. this is very helpful
@bartoszsroka4705
@bartoszsroka4705 2 жыл бұрын
Why introducing a concept of package-lock.json? I need exact version? I can remove tilda. Why overcomplicating things?
@justine_chang39
@justine_chang39 2 жыл бұрын
awesome video man!
@ca7986
@ca7986 2 жыл бұрын
This is amazing
@astrix8812
@astrix8812 2 жыл бұрын
Loved it!
@hellowill
@hellowill 2 жыл бұрын
Always use npm ci on the build pipeline!
@JLarky
@JLarky 2 жыл бұрын
6:30 this is cute. You are forgetting that even if they don't release a new version of express you can still get tons of updates, because express dependencies could have released new versions :)
@ivan07z583
@ivan07z583 2 жыл бұрын
Hahahaha the Will Smith part was so funny and unexpected
@parthokr
@parthokr 2 жыл бұрын
It would be nice if adding "$" restricts only patch updates.
@hakimbencella4242
@hakimbencella4242 2 жыл бұрын
Why should i depends on package_lock if i can fix (without adding ^ and ~ ) my version in package.json ? 🤔
@mehmetedex
@mehmetedex 2 жыл бұрын
"will smith" reference caught me off guard
@andrejvujic
@andrejvujic 2 жыл бұрын
What MacBook are you using?
@ddanielsandberg
@ddanielsandberg 2 жыл бұрын
NPM CI is "Clean Install". I never understood the obsession with version-ranges in the node-community. And then having to invent a lock-file when the penny dropped.
@babsNumber2
@babsNumber2 2 жыл бұрын
It's about giving options to developers. A person could decide to ignore the lock file while always upgrade or other teams could use the lock file more for reproducible deployments.
@arekxv
@arekxv 2 жыл бұрын
Using npm ci is the best for deployments but bad for development. Running ci can take a LONG time depending on how many packages you have, exactly because it is removing and renstalling all node_modules. We need an inbetween command which just does a diff and installs just what it needs to. Composer install honors this, why cant npm?
@user-xu9zx9fd7n
@user-xu9zx9fd7n 2 жыл бұрын
pnpm alternative for npm
@zorsen117
@zorsen117 2 жыл бұрын
So why should I use npm ci instead of just locking the specific version directly on my package.json? That's what confuses me ☹️
@hnasr
@hnasr 2 жыл бұрын
Because unfortunately while you can control your own packages by fixing the version, you can’t control all the dependency tree packages that downstream packages reference. One of those packages are marked as ^ or ~.
@zorsen117
@zorsen117 2 жыл бұрын
@@hnasr that makes a lot of sense. Thanks!!! Love your videos
@filipesommer8253
@filipesommer8253 2 жыл бұрын
Omg I lost it at the will smith reference lmao
@adusparx
@adusparx 2 жыл бұрын
The will smith troll was hilarious 😂😂
@RohanDas23
@RohanDas23 2 жыл бұрын
so a quick question.. if you want "4.16.1" exact, then why can't you remove the ~ or ^ and it will solve the problem, no need to use package-lock.json. Am I missing something?
@PhilipLon7
@PhilipLon7 2 жыл бұрын
You might want to update the packages according to the range specified in the package.json but you don't want to do the update by accident or on a CI / build server. You then update the packages intentionally locally and check in the updated lock file.
@RohanDas23
@RohanDas23 2 жыл бұрын
@@PhilipLon7 if i am not confident that update won't break my app, then why would I take the risk of updating more than 1 package at a time? And if I am updating only 1 package, then i can do it manually.
@bashardlaleh2110
@bashardlaleh2110 2 жыл бұрын
I actually had a problem a month ago where I created a gitlab auto deployment pipeline job that pulls the pushed code and runs npm install on the server and it always failed because npm install was changing the lock file on the server which was considered a change in the local git repo so the git pull fails "you have uncommited changes please stash them or commit" then I found out about npm ci and the job succeeded
@hnasr
@hnasr 2 жыл бұрын
Wow interesting! I bet it was nasty to find
@0xmg
@0xmg 2 жыл бұрын
npm ci means clean install tho right ?
@Cosines
@Cosines 2 жыл бұрын
good to see you using vim :)
@balajibobby8530
@balajibobby8530 2 жыл бұрын
Upvote
@darthnihiluz5305
@darthnihiluz5305 2 жыл бұрын
This seems like a nightmare for enterprises. Do they physically host their own approved repositories?
@hnasr
@hnasr 2 жыл бұрын
Yes most enterprises I suppose would have a controlled npm registry. Otherwise its a mess.
@shivaganga9148
@shivaganga9148 2 жыл бұрын
Awesome
@ademmohammed3939
@ademmohammed3939 2 жыл бұрын
ci=clean-install
@ozgur34
@ozgur34 2 жыл бұрын
Hussein Smith
@thedude5639
@thedude5639 2 жыл бұрын
I feel like he went full scottish for the 'caret'
@Miguel-Barcelo
@Miguel-Barcelo 2 жыл бұрын
$ npm ci Great job dude! thanks for sharing
@monstardev7189
@monstardev7189 2 жыл бұрын
the ''carrot''
@Chaaos2
@Chaaos2 2 жыл бұрын
Love it 😂
@Faruk-zt5iw
@Faruk-zt5iw 2 жыл бұрын
lmao at Will Smith part
@rohitbhatt7749
@rohitbhatt7749 2 жыл бұрын
vim is giving me anxiety.
@ca7986
@ca7986 2 жыл бұрын
❤️
@elotanth9538
@elotanth9538 2 жыл бұрын
🔥🔥🔥
@ericmackrodt9441
@ericmackrodt9441 2 жыл бұрын
Node package management is a huge mess...
@mikeaza
@mikeaza 2 жыл бұрын
green
@ms77grz
@ms77grz 2 жыл бұрын
🤣🤣🤣👍👍
Understanding Package-lock.Json | Javascript Tutorial
12:50
The Code Creative
Рет қаралды 7 М.
The Lifecycle of an HTTP Request in NodeJS
30:18
Hussein Nasser
Рет қаралды 25 М.
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 17 МЛН
娜美这是在浪费食物 #路飞#海贼王
00:20
路飞与唐舞桐
Рет қаралды 4,8 МЛН
SPILLED CHOCKY MILK PRANK ON BROTHER 😂 #shorts
00:12
Savage Vlogs
Рет қаралды 50 МЛН
Gli occhiali da sole non mi hanno coperto! 😎
00:13
Senza Limiti
Рет қаралды 22 МЛН
Google Patches Linux kernel with 40% TCP performance
12:03
Hussein Nasser
Рет қаралды 127 М.
Peer Dependencies - Explained
18:40
A shot of code
Рет қаралды 7 М.
The Beauty of the Internet Protocol
26:03
Hussein Nasser
Рет қаралды 22 М.
Distributed Transactions are Hard (How Two-Phase Commit works)
16:24
Hussein Nasser
Рет қаралды 33 М.
Пакетные менеджеры, composer, lock-файлы
17:21
What is NPM's package-lock.json?
3:24
Tom Gregory Tech
Рет қаралды 12 М.
Cloudflare Open sources Pingora (NGINX replacement)
29:33
Hussein Nasser
Рет қаралды 29 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 172 М.
You are using useFetch WRONG! (I hope you don't)
11:14
Alexander Lichter
Рет қаралды 26 М.
Самый крепкий телефон в мире. Какой? 🤯 #шортс
0:25
Антон Сошников
Рет қаралды 219 М.
ПС 110/10. Кто то подключил "левак" 110000 вольт!?
0:34
Советы электрика
Рет қаралды 1,4 МЛН
ноутбуки от 7.900 в тг laptopshoptop
0:14
Ноутбуковая лавка
Рет қаралды 4,2 МЛН
Как правильно светить смартфоном?
0:18
Люди.Идеи, общественная организация
Рет қаралды 571 М.
В ЧЕМ СЕКРЕТ ЗВУКОВ APPLE? | РАЗБОР
21:05
Google Pixel 9/Pro Review: Gimmick or Good?
24:05
Marques Brownlee
Рет қаралды 3,5 МЛН