我的堆栈: python 3.6 Node.js 11.3.0 jsii-0.20.11(通过npm安装aws cdk时自动安装)
我刚刚尝试了ckd init,然后进行了pip install -e。 之后,我进行了cdk部署,它给了我以下错误。
Traceback (most recent call last):
File "app.py", line 3, in <module>
from aws_cdk import core
File "C:\Users\sgoud12\myfolder\myprojects\myapp\cdk\.env\lib\site-packages\aws_cdk\core\__init__.py", line 1967, in <module>
class DependableTrait(metaclass=jsii.JSIIAbstractClass, jsii_type="@aws-cdk/core.DependableTrait"):
TypeError: __new__() got an unexpected keyword argument 'jsii_type'
Subprocess exited with error 1
(.env) C:\Users\sgoud12\myfolder\myprojects\myapp\cdk>
(.env) C:\Users\sgoud12\myfolder\myprojects\myapp\cdk>fs.js:122
throw err;
^
Error: EOF: end of file, read
at Object.readSync (fs.js:517:3)
at SyncStdio.readLine (C:\Users\sgoud12\myfolder\myprojects\myapp\cdk\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13350:25)
at InputOutput.read (C:\Users\sgoud12\myfolder\myprojects\myapp\cdk\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:13300:34)
at KernelHost.run (C:\Users\sgoud12\myfolder\myprojects\myapp\cdk\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:7231:32)
at Immediate.setImmediate (C:\Users\sgoud12\myfolder\myprojects\myapp\cdk\.env\lib\site-packages\jsii\_embedded\jsii\jsii-runtime.js:7239:37)
at processImmediate (timers.js:632:19)
答案 0 :(得分:0)
通常表示某种版本的missmarch:npm中的aws-cdk和python中的aws-cdk。鉴于这是一个很老的问题,我想更新所有软件包甚至重新安装环境都应该有所帮助。
在aws-cdk官方错误跟踪器中提到了类似的问题:
答案 1 :(得分:0)
我同意,这令人沮丧并且很难找到解决方法。使用@Trilliput中的链接
我的步骤:
命令:
sudo pip uninstall pip
brew update
sudo rm /usr/local/bin/aws
sudo rm /usr/local/bin/aws_completer
sudo rm -rf /usr/local/aws-cli
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
pip3 uninstall aws-cdk.cdk
pip3 install aws-cdk.cdk --use-feature=2020-resolver
那没有我希望的那样,所以我在下面使用了所有这些命令。我称它为焦土重装:
sudo pip uninstall pip
brew update
sudo rm /usr/local/bin/aws
sudo rm /usr/local/bin/aws_completer
sudo rm -rf /usr/local/aws-cli
brew uninstall node
brew uninstall pyenv
# CLOSE your terminal window and open a NEW terminal window.
# when you run [which python] you should get /usr/bin/python
# run these commands to remove node and npm
https://gist.github.com/TonyMtz/d75101d9bdf764c890ef
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
python3 get-pip.py
brew install python3
# old CDK
pip3 uninstall aws-cdk.cdk
#new CDK
pip3 uninstall aws-cdk.core
# NEW CDK
pip3 install aws-cdk.core
#pip3 install aws-cdk.core --use-feature=2020-resolver
# reinstall aws cdk
npm install -g aws-cdk
npm install -g npm@7.0.13
sudo npm install -g npm@7.0.13
npm install -g aws-cdk
sudo npm install -g aws-cdk
sudo -i
sudo npm install -g aws-cdk
cdk --version