Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

command npm install swiper failed - code 255

When I try to run npm install swiper throws an error. I tried to install swiper locally and globally with:

npm install swiper
npm install -g swiper

I successfully installed it globally. But when I try to install it again the error is the same.

Here is the error:

npm ERR! code 255
npm ERR! path C:\Users\Emir\Desktop\Project\portal\node_modules\swiper
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c 
C:\Users\Emir\AppData\Local\Temp\postinstall-cab5f01a.cmd
npm ERR! "Love Swiper? Support Vladimir's work by donating or pledging on patreon:"
npm ERR! The syntax of the command is incorrect.
like image 701
emirrozerr Avatar asked Dec 05 '25 17:12

emirrozerr


1 Answers

Hey you are probably a windows user like me.

I had this error fixed it by setting an environment variable

There is a problem with the swiper postinstall file

https://github.com/nolimits4web/swiper/blob/master/src/copy/postinstall.js

you need to bypass this

function isBannerRequired() {
  return !(ADBLOCK || CI || DISABLE_OPENCOLLECTIVE || SILENT || OPEN_SOURCE_CONTRIBUTOR);
}

so inside vs code open a terminal and write to bypass the equality test

 $env:OPEN_SOURCE_CONTRIBUTOR="true"

then try npm install

like image 120
beng_123 Avatar answered Dec 08 '25 06:12

beng_123



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!