无法解决org.nodejs:本地生成错误

时间:2019-02-22 09:56:25

标签: node.js angular gradle

我有一个Angular-App,它是从另一个存储库中派生的,他们在其中管理管道中的所有构建。

我想在我的本地系统(笔记本电脑)中构建它,然后将内置的应用程序推送到托管服务器中。

这是他们的build.gradle

node {
    version = "9.4.0"
    npmVersion = "5.6.0"
    download = true
}

task cleanProd(type: Delete) {
  delete "dist"
}

task testProd(type: NodeTask, dependsOn: npmInstall) {
  script = file("${projectDir}/node_modules/@angular/cli/bin/ng")
  args = ["test", "--browsers", "PhantomJS", "--watch=false", "--singleRun=true"]
}

task assembleProd(type: NodeTask, dependsOn: ['npmInstall', 'testProd']) {
  script = file("${projectDir}/node_modules/@angular/cli/bin/ng")
  args = ["build", "--prod", "--vendor-chunk=true"]
}

task copyDist(type: Copy) {
  from "dist/"
  into "dist/fancy-ui-${project.version}"
}

task buildProd(dependsOn: [assembleProd])

我执行了命令gradlew cleanProd buildProd copyDist,但遇到以下异常,我陷入困境

Build Version = build-713-ge359ca9
:cleanProd UP-TO-DATE
:nodeSetup FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nodeSetup'.
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
   > Could not resolve org.nodejs:node:9.4.0.
     Required by:
         :portal-ui:build-713-ge359ca9
      > Could not resolve org.nodejs:node:9.4.0.
         > Could not get resource 'https://nodejs.org/dist/v9.4.0/ivy.xml'.
            > Could not GET 'https://nodejs.org/dist/v9.4.0/ivy.xml'.
               > nodejs.org

我拥有所有必要的HTTP-Proxies,因此连接没有问题..只是该资源https://nodejs.org/dist/v9.4.0/ivy.xml没有被加载..但相同的代码和配置在{ {1}}服务器

1 个答案:

答案 0 :(得分:0)

我在节点10.14.1上遇到了同样的问题。

有一种解决方法可以解决该问题:

repositories.whenObjectAdded {
    if (it instanceof IvyArtifactRepository) {
        metadataSources {
            artifact()
        }
    }
}

摘自https://github.com/srs/gradle-node-plugin/issues/301