新项目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 install nodemailer` 错误 当遇到 `npm install nodemailer` 报错的情况时,可能由多种原因引起。以下是几种常见错误及其对应的解决方案。 #### 1. Node.js 和 npm 版本不兼容 确保使用的 Node.js 和 npm 是最新稳定版或至少满足 Nodemailer 所需最低版本要求[^1]。可以通过以下命令更新: ```bash # 更新 npm 到最新版本 npm install -g npm ``` 如果仍存在版本冲突问题,则考虑使用 nvm (Node Version Manager) 来切换不同版本的 Node.js 环境。 #### 2. Windows 平台下编译依赖失败(node-gyp) 对于某些操作系统特别是 Windows,在安装过程中可能会因为缺少必要的构建工具而导致 node-gyp 编译失败。此时可以按照如下方法处理[^2]: - 使用管理员权限打开命令提示符; - 运行 `npm install --global windows-build-tools` 安装所需 Visual C++ 工具链和其他资源; 这一步骤能够有效预防因本地环境缺失而引发的一系列连锁反应。 #### 3. DNS 库未被正确加载 有开发者反馈在 Vue 项目里集成 Nodemailer 后遇到了由于缺少 DNS 支持所造成的异常情况。为了避免此类状况发生,建议显式地安装并导入该模块作为补充措施之一[^3]: ```bash npm install dns ``` 需要注意的是,并不是所有的场景都需要额外安装此组件,仅当你确实碰到了相关警告信息才采取行动。 #### 4. package.json 文件损坏 另一个潜在因素在于项目的配置文件可能存在语法上的缺陷,比如 JSON 结构不合理等情形都会妨碍正常解析流程从而触发报错提示 "JSON 中意外的标记位置"[^4]。针对这种情况应该仔细检查 `package.json` 是否保持良好的格式化状态,必要时候借助在线验证器辅助排查。 最后提醒各位读者朋友,在执行任何更改之前最好先备份好现有设置以免造成不必要的损失!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Math.random( ) ;

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

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

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

打赏作者

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

抵扣说明:

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

余额充值