新项目npm install 时候报错

C:\workplace\workspace-ODN\pdnms-front>npm install
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t  https://github.com/openplans/Leaflet.AnimatedMarker.git 

npm ERR!
npm ERR! fatal: unable to access ' https://github.com/openplans/Leaflet.AnimatedMarker.git/ 

': error setting certificate verify locations:
npm ERR!   CAfile: E:/Program Files/Git/mingw32/ssl/certs/ca-bundle.crt
npm ERR!   CApath: none
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\arvin\AppData\Roaming\npm-cache\_logs\2017-11-21T10_24_49_985Z-debug.log 

解决: 

git config --global http.sslverify "false"    执行后重新npm install

可能再报错npm ERR! Command failed: git clone --mirror -q git://github.com/adobe-webplatform/eve.git..........

再执行:git config --global url."https://".insteadOf git:// 然后再:npm install

### 解决npm安装electron时出现的错误 在解决 `npm install electron` 时出现的错误时,需要综合考虑多种可能的原因。以下是一些常见的问题及其解决方案: #### 1. 环境依赖问题 确保系统已正确安装 Node.js 和 Python,并且版本兼容。Node.js 的版本过新或过旧都可能导致问题。推荐使用 LTS 版本的 Node.js[^2]。如果遇到无法找到模块的问题,可以参考 优快云 上关于 `cannot find module` 的文章[^1],了解其原理和解决思路。 #### 2. 模块拉取失败 当使用 `npm` 安装依赖时,可能会因为网络原因导致某些模块(如 `node-gyp`)无法正常拉取。此时可以尝试使用淘宝镜像来加速模块的下载。具体方法是运行以下命令: ```bash npm config set registry https://registry.npmmirror.com ``` 此外,也可以通过安装 `node-gyp-install` 来解决相关问题: ```bash npm install node-gyp-install ``` 这一步骤能够帮助修复因 `node-gyp` 缺失而导致的错误[^1]。 #### 3. 版本冲突 如果在安装过程中遇到版本冲突问题,可以尝试清理缓存并重新安装: ```bash npm cache clean --force npm install electron --save-dev ``` 如果仍然无效,可以降级 Node.js 到更稳定的版本,例如 v7.6.0 或 v14.x LTS[^3]。 #### 4. Windows 平台下的特殊问题 在 Windows 系统上,安装 `electron` 可能需要额外的工具链支持。建议安装 Visual Studio 并配置好环境变量。同时,确保系统中已安装 `windows-build-tools`,可以通过以下命令安装: ```bash npm install --global --production windows-build-tools ``` #### 5. SQLite3 相关问题 如果项目中还涉及 `sqlite3` 的使用,可以参考 GitHub 上的相关讨论[^1],确保所有依赖项均已正确拉取。 ### 示例代码 以下是一个简单的脚本,用于检查和修复 `electron` 安装过程中可能出现的问题: ```bash # 清理缓存 npm cache clean --force # 设置淘宝镜像 npm config set registry https://registry.npmmirror.com # 安装electron npm install electron --save-dev # 如果仍有问题,尝试安装node-gyp npm install node-gyp-install ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Math.random( ) ;

如果你刚好喜欢,则可以给我点动

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值