I have changed laptops recently and when I run
amplify publish -c
I get this error:
Error: You are not working inside a valid amplify project.
Use 'amplify init' in the root of your app directory to initialize your project with Amplify
I created an aws cloudfront through amplify previously but is it possible to reinitialise amplify on a new machine.
i committed all files to source control so i canβt understand from the error message what is missing
@dagda1 When you changed laptops did you run the amplify configure project command from the root of your project? If not, then please run that and then execute the subsequent commands.
i have done this but all it did was create s new iam role. then when j try and publish i get the same error message
@dagda1 That would be the amplify configure command. I was referring to the amplify configure project command.
@kateglee I get the same message from amplify configure project
Looking at the code:
function getProjectConfigFilePath(projectPath) {
return path.normalize(path.join(
getDotConfigDirPath(projectPath),
amplifyCLIConstants.ProjectConfigFileName,
));
}
What is it looking for that it cannot find in getDotConfigDirPath(projectPath)
I have a amplify folder which has a backend folder with these child folders
amplify-meta.json awscloudformation/ hosting/
and in fact projectPath is undefined.
so there is no .amplify folder. This is a hidden folder which is probably why it has not been persisted across my change of laptop.
WHat can I do to reconfigure without starting afresh. I have cloudfront and route53 etc. set up for many months and I'd hate to have to do all that again, never mind a DNS change.
anybody help me with this. Is my amplify toast?
@dagda1 What does your project structure look like? Do you see the amplify sub-directory in your app/project directory?
@kaustavghosh06 here is what tree outputs
.
βββ LICENSE
βββ README.md
βββ amplify
βΒ Β βββ backend
βΒ Β βββ amplify-meta.json
βΒ Β βββ awscloudformation
βΒ Β βΒ Β βββ nested-cloudformation-stack.yml
βΒ Β βββ hosting
βΒ Β βββ S3AndCloudFront
βΒ Β βββ template.json
βββ data
Can you run the amplify status command from the root of your project?
Also which system are you using currently? and what's the version of the CLI that you're using?
It is the same error every time
Error: You are not working inside a valid amplify project.
I've checked the code as I mentioned above, when amplify runs it looks for a hidden .amplify directory which does not exist because it did not survive my move to a new laptop.
If the directory does not exist then the error gets displayed
@dagda1 We don't create a .amplify dir but create a amplify/.config directory which seems to be missing in your case. Would it be possible to retreive the amplify/.config directory?
@kaustavghosh06 no, I think the fact that it is a hidden folder means it did not come across.
Is there anything else I can do?
Which version of the CLI were you using? the one in mainline or @multienv? I can help you rebuild your .config folder manually.
oh man, thank you so much.
I am on 0.1.45
Here's the .config folder structure:
amplify
|_.config
|_aws-info.json
|_project-config.json
Here's a sample of these above mentioned config files. Plase fill/substitue it with your custom information.
aws-info.json
{
"configLevel": "project",
"useProfile": true,
"profileName": "default"
}
project-config.json
{
"projectName": "testbeta",
"projectPath": "/Users/kaustavg/testbeta",
"defaultEditor": "sublime",
"frontendHandler": {
"javascript": "amplify-frontend-javascript"
},
"javascript": {
"framework": "none",
"config": {
"SourceDir": "src",
"DistributionDir": "dist",
"BuildCommand": "npm run-script build",
"StartCommand": "npm run-script start"
}
},
"providers": {
"awscloudformation": "amplify-provider-awscloudformation"
}
}
You can run amplify configure project command to modify any of these values int he future.
brilliant, thank youi
Most helpful comment
Here's the .config folder structure:
amplify
|_.config
|_aws-info.json
|_project-config.json
Here's a sample of these above mentioned config files. Plase fill/substitue it with your custom information.
aws-info.json
project-config.json
You can run
amplify configure projectcommand to modify any of these values int he future.