java aws cdk找不到“jsii运行时”可执行文件

66bbxpm5  于 2021-07-03  发布在  Java
关注(0)|答案(1)|浏览(414)

我第一次尝试使用aws-cdk。
我在构建java应用程序时遇到以下错误

Cannot find the 'jsii-runtime' executable

maven依赖

<dependency>
    <groupId>software.amazon.awscdk</groupId>
    <artifactId>cdk-cloudformation-include</artifactId>
    <version>1.79.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/software.amazon.jsii/jsii-runtime -->
<dependency>
    <groupId>software.amazon.jsii</groupId>
    <artifactId>jsii-runtime</artifactId>
    <version>1.16.0</version>
</dependency>
<dependency>
    <groupId>software.amazon.awscdk</groupId>
    <artifactId>s3</artifactId>
    <version>1.79.0</version>
</dependency>

java代码

import software.amazon.awscdk.core.Construct;
import software.amazon.awscdk.core.Stack;
import software.amazon.awscdk.core.StackProps;
import software.amazon.awscdk.cloudformation.include.CfnInclude;

public class MyStack extends Stack {
    public MyStack(final Construct scope, final String id) {
        this(scope, id, null);
    }

    public MyStack(final Construct scope, final String id, final StackProps props) {
        super(scope, id, props);

        CfnInclude template = CfnInclude.Builder.create(this, "Template")
            .templateFile("/home/vmdovs/NetBeansProjects/cf-import/yaml2/ubuntu16.04LTS_cfn-hup.yaml")
            .build();

    }
}

  public void testawscdk() {
    App app = new App();

    new MyStack(app, "MyStack");
}

让我知道你的想法

thigvfpy

thigvfpy1#

错误的原因是没有安装aws cdk
以下安装脚本解决了该问题

apt-get install python3-pip -y

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --config python

sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
sudo update-alternatives --config pip

pip install aws-cdk.cdk

pip install awscli

export PATH=/home/vagrant/.local/bin:$PATH

echo "export PATH=/home/vagrant/.local/bin:$PATH" >> .bashrc

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

node --version

sudo npm install -g aws-cdk

相关问题