An warware: ERR%21 code ELIFECYCLE npm ERR%21 kuskure 2

Farawa daga ainihin yanayin ci gaban Node.js, zurfafa zurfafa cikin duniyar coding na iya kawo wasu kurakurai da ke barin mu a tsaka-tsaki. ฦŠayan irin wannan kuskuren shine sananne ERR! code ELIFECYCLE npm ERR! kuskure 2, wanda sau da yawa yana faruwa lokacin aiwatar da rubutun ta amfani da NPM a cikin yanayin Node.js.

Wannan kuskuren yana tasowa ne ta hanyar gazawar aikin Node.js don aiwatar da rubutun gininsa daidai. Fuskantar irin wannan kuskuren a tsakiyar aiwatar da aikace-aikace mai mahimmanci na iya zama mai takaici sosai kuma yana haifar da cikas ga ci gaba. Koyaya, kada ku ji tsoro, saboda ana iya gyara wannan tare da ษ—imbin umarni da aka tsara daidai.

Hanyar ฦ˜addamarwa

Yawancin lokaci, lokacin da muka haษ—u da ERR! code ELIFECYCLE npm ERR! errno 2, yana da mahimmanci don tsaftace cache npm ta hanyar aiwatar da umarnin `

npm cache clean --force

`. Buga wannan, mataki na gaba shine share babban fayil 'node_modules' tare da fayil 'package-lock.json'. Da zarar an cire waษ—annan, sake shigar da aikin ta amfani da npm na iya magance matsalar.

Yin nazarin Magani

Maganin wannan matsala shine ainihin mai sauฦ™i. A mataki na farko, lokacin da kake gudanar da umarni `

npm cache clean --force

`, abin da ke faruwa da gaske shine npm yayi aiki da umarnin ku don share cache ษ—in sa. Wannan yana nufin cire duk bayanan da ya kasance yana adanawa akan tsarin ku wanda ya shafi fakitin da aka shigar da nau'ikan su.

Bayan haka, muna share kundin adireshin 'node_modules' da fayil 'package-lock.json'. Anan ne npm ke shigar da abubuwan dogaro da aikin, kowanne a cikin babban fayil ษ—in sa. Ana samar da fayil ษ—in 'kunki-lock.json' ta atomatik don kowane aiki inda npm ya canza ko dai 'node_modules' directory, ko 'package.json' kuma an yi niyya don kulle nau'ikan abubuwan dogaro na kunshin.

Mataki na uku, reinstallation, da gaske sake zazzage abubuwan dogaro kuma yana gyara yanayin da ya karye.

Laburaren da suka dace da Ayyuka

Fahimtar mai amfani da npm da yanayin Node.js yana da mahimmanci don warware wannan batu. Wannan mawuyacin sau da yawa yana tasowa saboda bambance-bambance ko rashin aiki a cikin abubuwan dogaro da aka shigar, don haka yana da mahimmanci a bincika 'npm`kuma`Node.js`- bangarorin biyu na wannan maganin.

  • NPM (Mai sarrafa fakitin Node) yana goyan bayan al'ummar Node.js ta hanyar samar da ingantaccen bayani don shigar da fakiti, sarrafa dogaro, da sarrafa sigar. Yana daidaita tsarin haษ—a kayan aikin ษ“angare na uku da kayayyaki a cikin aikace-aikacen ku.
  • Node.js, a gefe guda, buษ—aษ—ษ—en tushe ne, yanayin lokaci na lokaci mai tsawo na JavaScript. An ฦ™irฦ™ira ฦ™irar sa akan tsarin gine-ginen da ke tafiyar da taron JavaScript wanda ke ba da izinin asynchronous, nau'in aiki mara toshewa. Wannan sifa ta sa Node.js ya zama babban ษ—an takara don aikace-aikacen ainihin lokaci.

Fuskantar ERR! code ELIFECYCLE npm ERR! errno 2 bai kamata ya zama babban abin tsoro ga masu haษ“akawa ba - da zarar an fahimci dalilin matsalar, ana iya aiwatar da mafita cikin sauฦ™i, kuma tsarin ci gaba zai iya ci gaba da tasiri ba tare da tsangwama ba.

Shafi posts:

Leave a Comment