微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

类型错误:创建放大时无法读取未定义的属性“projectPath”

如何解决类型错误:创建放大时无法读取未定义的属性“projectPath”

我尝试构建一个网络应用程序,使用前端作为角度,后端作为放大。

我创建了 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)

解决方法

我使用的是 4.47.1 版的 amplify cli,也遇到了这个问题。从@Tyr52 对上述问题的评论中,我能够转到 GitHub 已知问题 link 并找到一个似乎可以解决该问题的运行命令。由于我是 amplify 的新手,我不确定它是否完全解决了所造成的任何问题,但它似乎允许我继续我所关注的 AWS tutorial

命令:

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。