windows - 无法在cmd中使用gradle build启动命令 'npm''

标签 windows gradle cmd npm

当前正在尝试运行gradlew build,但是在我的计算机上重新安装Windows之后,它不再起作用。任何帮助都会得到应用

我在命令提示符下遇到的错误在下面

  • 出了什么问题:
    任务':www:node'的执行失败。

    A problem occurred starting process 'command 'npm''


       exec {
            workingDir 'src/main/web'
            commandLine 'npm', 'install'
        }
    
  • 最佳答案

    在同时使用Windows和* nix的项目上时,我遇到了类似的问题。我这样修复了...

    if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
        commandLine 'npm.cmd', 'install'
    } else {
        commandLine 'npm', 'install'
    }
    

    对于Windows,您需要使用.cmd

    关于windows - 无法在cmd中使用gradle build启动命令 'npm'',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39066781/

    相关文章:

    grails - 有什么办法可以反编译grails/groovy jar文件?

    安卓工作室 : How to remove/filter build variants for default debug and release buildTypes and keep only those using custom buildTypes?

    cmd - 将文件复制到同一目录中的多个文件夹

    windows - 用Golang查询Windows总物理内存

    windows - 如何判断 Win32_NTLogEvent InsertionString 是否存在?

    windows - 如何创建带有不透明子控件(或子窗口)的透明窗口?

    kotlin - build.gradle.kts Java函数

    带参数的 C++ 简单线程(无 .net)

    matlab - 将 dos 命令输出显示为静态文本

    windows - 删除目录中与某些文件扩展名不匹配的文件