npm install 无法执行 postinstall 脚本 bower install

标签 npm bower

我在网上窥探了超过 48 小时,但未能解决这个问题。

当我运行命令“npm install”时,它无法执行安装后脚本“bower install”。因此,我使用以下方法进行了明确的 bower 安装:

$npm install -g bower

$bower install

在此之后,“app/bower_components”文件夹被填充好了。但是,当我再次尝试“npm install”时,同样的问题。无法进一步进行。

我执行了以下操作并没有成功安装:
  • 已安装 Git 并将其路径添加到 PATH 环境变量中。然后运行“npm install”。甚至重新启动命令提示符以反射(reflect) PATH 变量。
  • 运行“npm install restify”,虽然我不知道为什么必须将安装设置为 REST 服务。
    我使用了这个,因为这是我遇到的建议之一。
  • 在一些帖子中,有人提到这可能是由于防火墙设置造成的。禁用相同并尝试过。
  • 将我的项目“angular-phonecat”下的所有文件更改为具有读写权限。通过取消选中整个文件夹内容的“只读”选项来做到这一点。
  • 以管理员身份运行 Git Bash 并尝试“npm install”。

  • 请帮我运行这个应用程序。 :(

    在我的日志下面找到:
    600 info install angular-phonecat@0.0.0  
    601 info postinstall angular-phonecat@0.0.0  
    602 verbose unsafe-perm in lifecycle true  
    603 info angular-phonecat@0.0.0 Failed to exec postinstall script  
    604 error angular-phonecat@0.0.0 postinstall: `bower install`  
    604 error spawn ENOENT  
    605 error Failed at the angular-phonecat@0.0.0 postinstall script.  
    605 error This is most likely a problem with the angular-phonecat package,  
    605 error not with npm itself.  
    605 error Tell the author that this fails on your system:  
    605 error     bower install  
    605 error You can get their info via:  
    605 error     npm owner ls angular-phonecat  
    605 error There is likely additional logging output above.  
    606 error System Windows_NT 6.2.9200  
    607 error command "g:\\Workspace\\AngularProjects\\angular-phonecat\\node.exe" "g:\\Workspace\\AngularProjects\\angular-phonecat\\node_modules\\npm\\bin\\npm-cli.js" "install"  
    608 error cwd g:\Workspace\AngularProjects\angular-phonecat  
    609 error node -v v0.10.32  
    610 error npm -v 1.4.28  
    611 error syscall spawn  
    612 error code ELIFECYCLE  
    613 error errno ENOENT  
    614 verbose exit [ 1, true ]  
    

    最佳答案

    您需要提供更多信息才能获得此问题的答案。看起来像 angular-phonecat是你自己创建的模块——你能发布它的package.json吗?作为要点https://gist.github.com并在此处附上链接?

    另外,您的 npm相当老(甚至在你问这个问题的时候)。我建议更新到 npm 的最新版本,在撰写本文时为 2.2.0。

    要在 Windows 上更新 npm,请按照此处的说明进行操作:https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

    谢谢!

    关于npm install 无法执行 postinstall 脚本 bower install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26452205/

    相关文章:

    node.js - 我可以在不复制公共(public)存储库的情况下运行私有(private) npm 存储库吗?

    gruntjs - 如何修改 grunt 以在运行 dist 命令时排除所有 Bower_Component 自述文件和示例文件?

    node.js - Ubuntu 18.04 - npm 更新 - 错误 : canvas@2. 6.1 安装: `node-pre-gyp install --fallback-to-build`

    javascript - 通过exceljs模块读取Excel

    javascript - 在上面的目录中找不到bower_components

    node.js - 安装 Yeoman Angular 依赖项时遇到问题

    angularjs - 我需要什么来包含那个 Angular Bootstrap 才可以工作

    Bower update return me invalid-meta "name"建议小写,可以包含数字、点、破折号

    reactjs - 如何修复 npm 审核修复问题?

    node.js - Travis - 控制哪个 Node 版本用于 NPM 安装