命令 npm install swiper 失败 - 代码 255

问题描述 投票:0回答:4

当我尝试运行

npm install
swiper 时会抛出错误。我尝试在本地和全局安装 swiper:

npm install swiper
npm install -g swiper

我成功地在全球范围内安装了它。但是当我尝试再次安装时,错误是一样的。

这是错误:

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.
node.js npm swiper.js
4个回答
6
投票

嘿,你可能是像我一样的 Windows 用户。

我通过设置环境变量修复了这个错误

swiper postinstall 文件有问题

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

你需要绕过这个

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

所以在 vs code 中打开一个终端并写入以绕过相等性测试

 $env:OPEN_SOURCE_CONTRIBUTOR="true"

然后尝试 npm install


1
投票

从 package.json 文件中删除 Swiper,并删除 node_modules 和 package-lock.json 文件。

之后分别 npm install --forcenpm install swiper --force


0
投票

我删除了项目文件夹中的滑动器并且它起作用了!


0
投票

对我来说效果很好。节点版本?刷卡版本。 NPM 版本? “刷卡器”:“^8.4.3”。没有与此相关的已知问题。还要检查其他包。 Careerkarma.com/blog/npm-command-not-found – 埃兹拉·西顿

© www.soinside.com 2019 - 2024. All rights reserved.