Amplify-console: Amplify Console Build fails - Error: ENOENT: no such file or directory

Created on 31 Jul 2019  路  8Comments  路  Source: aws-amplify/amplify-console

Describe the bug
Cannot get my project to build using the amplify console. No obvious causes for the build to fail.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project using amplify init
  2. Run amplify add api to create a new graphQL API. In my case I provided my own schema from another AWS AppSync project.
  3. amplify push your project to the amplify-console service.
  4. Click "redeploy this version" from the amplify console.

Amplify console backend Logs:
build_fails

Expected behavior
I expect the app to build without errors.

Additional context
I found someone with a similar issue and they mentioned that specifying the npm version in the build script could alleviate the problem along with uninstalling and re-installing the amplify-cli. This hasn't worked for me.

Sample code
amplify.yml

version: 0.1
backend:
  phases:
    build:
      commands:
        - nvm use 10
        - npm uninstall -g @aws-amplify/cli 
        - rm -rf node_modules/@aws-amplify/
        - npm install -g @aws-amplify/[email protected]
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
bug

All 8 comments

Upon looking at my github repo I noticed that the project directory name wasn't capitalized and was causing my project to not be found. Doesn't look like git respects casing by default. Configuring git using git config --local core.ignorecase false solved the problem.

@nickeyvee impressed you found a solution to that weird problem! We'd like to ensure other folks don't run into a similar issue. Some questions:

  1. Were you connecting to a backend created by the CLI?
  2. What project directory name are you referring to?

@swaminator Sorry for the late reply.

  1. Yes, I used the Amplify CLI.
  2. I'm referring to the files generated when adding a new backend API. From the root of your project the path would be ~/amplify/backend/api/<YOUR-API-NAME>/

Thanks! Closing issue.

@swaminator Was this closed because it was fixed? I am having the same problem by the looks of things.

The odd thing is that I had the opposite problem than the OP. Amplify is looking for a case insensitive directory but git is storing it as case sensitive.

Renaming it in amplify/backend/backend-config.json and amplify/backend/api/foo/parameters.json seemed to do the trick.

The odd thing is that I had the opposite problem than the OP. Amplify is looking for a case insensitive directory but git is storing it as case sensitive.

I had the same issue with codebuild and amplify, it turns out we had a file changed from camelCase to lowercase and git obviously did not notice.
I solve renaming said file into lowercase (delete file -> commit -> add file with lowercase -> commit)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

patleeman picture patleeman  路  5Comments

dongjason1 picture dongjason1  路  3Comments

lucaluke88 picture lucaluke88  路  4Comments

BardiaN picture BardiaN  路  4Comments

hassankhan picture hassankhan  路  4Comments