node.js - 尝试安装项目依赖项时运行 npm i(退出代码 1)时发生错误

标签 node.js angular ionic3 node-modules ionic-cli

我只是将一个 Ionic 项目克隆到我的电脑上,因为使用了 .gitignore,指令中没有安装 node_modules ...所以当我在 CLI 中输入 ionicserve 时,它​​给出了这个错误

?看起来像是新鲜出炉的结账!未找到 ./node_modules 目录。您想安装项目依赖项吗?是的 安装依赖项可能需要几分钟!

npm i × Running command - failed! [ERROR] An error occurred while running npm i (exit code 1):

    npm ERR! code 1
    npm ERR! Command failed: C:\Program Files\Git\cmd\git.EXE submodule update -q --init --recursive
    npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: basename: command not found
    npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: sed: command not found
    npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 19: .: git-sh-setup: file not found
    npm ERR!

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\malre\AppData\Roaming\npm-cache\_logs\2018-06-28T14_57_56_909Z-debug.log

我可以做什么来解决这个问题?

谢谢

最佳答案

您使用的是哪个文件系统?你碰巧在 Windows 上使用 bash 吗?您是否运行了 npm install -g ionic cordova ?如果这就是您失败的地方,请以管理员身份运行您正在使用的终端或以 root 身份运行 npm i

这应该可以解决您的问题。

关于node.js - 尝试安装项目依赖项时运行 npm i(退出代码 1)时发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51086687/

相关文章:

javascript - 未找到 Puppeteer 'Page.getFrameTree' undefined

javascript - 使用 ShouldJS 比较来自 Mongoose 的数组

javascript - 如何针对不同的容器使用javascript方法?

html - Angular4 "required"表单提交时未检查属性

javascript - Angular 5 - 从子组件输入 [(ngModel)] 绑定(bind)更改父属性

angular - Enter键以Ionic 4 Angular 8形式移动到下一个元素

mysql - Node.js 应用程序部署在谷歌云上,与不同服务器上的远程 mysql 连接。

javascript - 使用 fetch 或 axios 发送身份验证 header

javascript - 套接字 io 传输错误

rxjs - ionic 3 找不到模块 "rxjs/operators/share"