DEV Community

Cover image for Have you tried switching it off and on again?
Sung M. Kim
Sung M. Kim

Posted on

Have you tried switching it off and on again?

I just wanted to share this insightful comment on Reddit.

reddit comment

I've seen HelpDesk technicians at work asking,

"Have you tried switching it off and on again?"

several times a day, thus I bursted into laugher.

Please feel free to share if you think of any others ๐Ÿ˜‰

Top comments (11)

Collapse
 
joshuagilless profile image
Joshua Gilless • Edited

It can get even worse. There was a time at work where we were struggling to get people to all use the same npm version. One of the developers put this in the scripts section of our package.json:

"relock": "rm -rf node_modules/ && rm package-lock.json && npm i"

Collapse
 
dance2die profile image
Sung M. Kim

It sounds like that's the problem npm ci tries to solve

Related to the original response, npm 6 now allows you to run
npm ci
Which deletes the node_modules and installs the exact version mentioned in your lock file. This is a great way to reproduce the exact working copy of your node app.

Collapse
 
joshuagilless profile image
Joshua Gilless

Yeah! It mostly is, but the subtle difference was our package-lock.json files were out of sync. We were just having a hard time getting everyone on the same version of npm, so the package-lock.json files generated by npm install were slightly different. npm ci runs based off of package-lock.json

Thread Thread
 
dance2die profile image
Sung M. Kim

Now I see what you means.

While npm ci tries to make library to be consistent across computers,
relock command installs libraries from clean slate.

Collapse
 
kepta profile image
Kushan Joshi

Related to the original response, npm 6 now allows you to run
npm ci
Which deletes the node_modules and installs the exact version mentioned in your lock file. This is a great way to reproduce the exact working copy of your node app.

Collapse
 
dance2die profile image
Sung M. Kim

Thanks for the tip Kushan.

Even this morning, I've deleted node_modules folder manually...

npm ci seems like a great addition to the CLI. ๐Ÿ‘

Collapse
 
andrewlucker profile image
Andrew Lucker

Today it took me way too long to remember that most of the internet works on a variant of this principle:

"Try switching it on and off again, then wait several hours."

Collapse
 
dance2die profile image
Sung M. Kim

๐Ÿ˜ƒ Takes a while for DNS records to propagate.

That's probably the easiest way to let non-technical people to wait just long enough ๐Ÿ˜‰

Collapse
 
scottishross profile image
Ross Henderson

Just throwing it out there: my previous job was a Technical Advisor for a Mobile Phone Insurance Company. Statistically, the fix most likely to work was legitimately turning it off and on again!

Collapse
 
dance2die profile image
Sung M. Kim • Edited

Seems like data don't lie

๐Ÿ˜›

Collapse
 
zvakh profile image
Zoryana Vakh

Without doubt, It works!) That's what experience says