TypeError: Cannot read property 'projectPath' of undefined when create amplify

TypeError: Cannot read property 'projectPath' of undefined when create amplify

我尝试构建一个 Web 应用程序,使用前端作为 angular,使用后端作为放大。

我创建了 angular 应用程序,然后我添加了以下 src/polyfills.ts 文件来重新创建它们:

(window as any).process = {
  env: { DEBUG: undefined },
};

下一步我创建新的放大后端

amplify init

显示此错误后:

Note: It is recommended to run this command from the root of your app directory
? Enter a name for the project amplifyapp
The following configuration will be applied:

Project information
| Name: amplifyapp
| Environment: dev
| Default editor: Visual Studio Code
| App type: javascript
TypeError: Cannot read property 'projectPath' of undefined
    at getAngularConfig (/snapshot/node_modules/amplify-frontend-javascript/lib/framework-config-mapping.js:57:52)
    at getProjectConfiguration (/snapshot/node_modules/amplify-frontend-javascript/lib/framework-config-mapping.js:85:14)
    at Object.displayFrontendDefaults (/snapshot/node_modules/amplify-frontend-javascript/lib/configuration-manager.js:173:32)
    at Object.displayFrontendDefaults (/snapshot/node_modules/amplify-frontend-javascript/index.js:40:24)
    at displayAndSetDefaults (/snapshot/node_modules/@aws-amplify/cli/lib/init-steps/s0-analyzeProject.js:83:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async analyzeProject (/snapshot/node_modules/@aws-amplify/cli/lib/init-steps/s0-analyzeProject.js:99:9)
    at async Object.run (/snapshot/node_modules/@aws-amplify/cli/lib/commands/init.js:29:13)
    at async Object.executeAmplifyCommand (/snapshot/node_modules/@aws-amplify/cli/lib/index.js:236:9)
    at async executePluginModuleCommand (/snapshot/node_modules/@aws-amplify/cli/lib/execution-manager.js:164:5)
    at async Object.executeCommand (/snapshot/node_modules/@aws-amplify/cli/lib/execution-manager.js:35:9)
    at async Object.run (/snapshot/node_modules/@aws-amplify/cli/lib/index.js:112:9)

我使用的是 amplify cli 4.47.1 版,也遇到了这个问题。从@Tyr52 对上述问题的评论,我能够转到我关注的 GitHub 已知问题 link and find a command to run that appears to workaround the problem. As I am new to amplify I'm not sure it completely fixes any problem that was created, but it appears to allow me to continue with the AWS tutorial

命令:

amplify env add
# init command may not be needed, but I did it anyway
amplify init