TypeError: Cannot read property 'projectPath' of undefined

0

When I run the cli:

> amplify init  

from within a fresh npm created application, I get the error in the Subject of this post.

When I run amplify init in a fresh directory with no npm configuration (empty) and I examine the file amplify/.config/project-config.json it does not contain an entry for projectPath. However, when reviewing the documentation for the console application https://haverchuck.github.io/docs/cli/init?sdk=js about halfway down, the docs show a project-config.json file containing the entry: "projectPath": "/Users/kaustavg/test890".

It looks the version of the CLI I'm using (4.47.1) does not place an entry for projectPath in the project-config.json file either in a clean start or in a freshly created npm created application.

Or, there's something I'm doing wrong. Does anyone have any insight?

Thanks.

Andy

PS: here are the commands as executed in a fresh directory:

# Following tutorial: https://docs.amplify.aws/start/q/integration/angular  
npx -p @angular/cli@11.2.8 ng new amplify-app  
# edit polyfills.ts and add shims  
cd amplify-app  
amplify init  
# Error thrown  

Also, this:

mkdir tst-amp-init  
amplify init  

Edited by: codeedog on Apr 13, 2021 4:01 PM

gefragt vor 3 Jahren792 Aufrufe
1 Antwort
0

This appears to be a recent and known issue: https://github.com/aws-amplify/amplify-cli/issues/7057

The above link contains a workaround, which is to run:

amplify env add  

This appears to have solved my problem. Note: I also ran amplify init, although this may have been overkill.

beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen