aws-amplify / amplify-hosting

AWS Amplify Hosting provides a Git-based workflow for deploying and hosting fullstack serverless web applications.
https://aws.amazon.com/amplify/hosting/
Apache License 2.0
459 stars 116 forks source link

Frontend build failing with npm ERR! code E401 Incorrect or missing password. #3403

Open emilylubkert opened 1 year ago

emilylubkert commented 1 year ago

Before opening, please confirm:

App Id

d2zkpy9s6mky8z

AWS Region

us-west-1

Amplify Hosting feature

Frontend builds

Describe the bug

I am trying to deploy a React frontend app, but keep running into this error: npm error code E401 Incorrect or missing password.

Expected behavior

Frontend build completes successfully and app is deployed.

Reproduction steps

  1. Click on "Build" step on Amplify console main page.
  2. Click on "Redeploy this version."
  3. See error appear in build logs.

Build Settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - cd client
        - npm install
    # IMPORTANT - Please verify your build commands
    build:
      commands:
      - npm run build
  artifacts:
    # IMPORTANT - Please verify your build output directory
    baseDirectory: ./client/build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Log output

``` # Put your logs below this line # Starting phase: preBuild # Executing command: cd client 2023-04-03T20:22:44.681Z [INFO]: # Executing command: npm install 2023-04-03T20:22:57.346Z [WARNING]: npm 2023-04-03T20:22:57.348Z [WARNING]: WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility 2023-04-03T20:22:58.047Z [WARNING]: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser 2023-04-03T20:22:58.186Z [WARNING]: npm WARN deprecated 2023-04-03T20:22:58.186Z [WARNING]: w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin. 2023-04-03T20:22:58.270Z [WARNING]: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead 2023-04-03T20:22:58.508Z [WARNING]: npm WARN 2023-04-03T20:22:58.509Z [WARNING]: deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. 2023-04-03T20:23:01.457Z [WARNING]: npm WARN 2023-04-03T20:23:01.459Z [WARNING]: deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x. 2023-04-03T20:23:14.382Z [WARNING]: npm ERR! code E401 2023-04-03T20:23:14.384Z [WARNING]: npm ERR! Incorrect or missing password. npm ERR! If you were trying to login, change your password, create an npm ERR! authentication token or enable two-factor authentication then npm ERR! that means you likely typed your password in incorrectly. npm ERR! Please try again, or recover your password at: npm ERR! https://www.npmjs.com/forgot npm ERR! npm ERR! If you were doing some other operation then your saved credentials are npm ERR! probably out of date. To correct this please try logging in again with: npm ERR! npm login 2023-04-03T20:23:14.384Z [WARNING]: 2023-04-03T20:23:14.385Z [WARNING]: npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2023-04-03T20_22_44_907Z-debug-0.log 2023-04-03T20:23:14.412Z [ERROR]: !!! Build failed 2023-04-03T20:23:14.412Z [ERROR]: !!! Non-Zero Exit Code detected 2023-04-03T20:23:14.412Z [INFO]: # Starting environment caching... 2023-04-03T20:23:14.412Z [INFO]: # Environment caching completed Terminating logging... ```

Additional information

No response

emilylubkert commented 1 year ago

Build is successful with manual deploy in Amplify and when hosted as static website from S3 bucket.

ghost commented 1 year ago

Hi @emilylubkert thank you for raising this issue and testing out the deployment. Is it possible that you are trying to install a private package during the CI/CD build?

emilylubkert commented 1 year ago

Thanks for responding! As far as I know, I am not using any private packages. Here is my package.json:

{
  "name": <name>,
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.10.5",
    "@emotion/styled": "^11.10.5",
    "@fortawesome/fontawesome-pro": "^6.3.0",
    "@fortawesome/fontawesome-svg-core": "^6.3.0",
    "@fortawesome/pro-duotone-svg-icons": "^6.3.0",
    "@fortawesome/pro-light-svg-icons": "^6.3.0",
    "@fortawesome/pro-regular-svg-icons": "^6.3.0",
    "@fortawesome/pro-solid-svg-icons": "^6.3.0",
    "@fortawesome/pro-thin-svg-icons": "^6.3.0",
    "@fortawesome/react-fontawesome": "^0.2.0",
    "@fortawesome/sharp-regular-svg-icons": "^6.3.0",
    "@fortawesome/sharp-solid-svg-icons": "^6.3.0",
    "@mui/icons-material": "^5.11.11",
    "@mui/material": "^5.11.9",
    "@react-google-maps/api": "^2.18.1",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "bootstrap": "^5.2.3",
    "chart.js": "^4.2.1",
    "formik": "^2.2.9",
    "highcharts": "^10.3.2",
    "iconify": "^1.4.0",
    "localforage": "^1.10.0",
    "lodash": "^4.17.21",
    "match-sorter": "^6.3.1",
    "react": "^18.2.0",
    "react-bootstrap": "^2.7.2",
    "react-chartjs-2": "^5.2.0",
    "react-dom": "^18.2.0",
    "react-router-bootstrap": "^0.26.2",
    "react-router-dom": "^6.8.1",
    "react-router-hash-link": "^2.4.3",
    "react-scripts": "5.0.1",
    "react-slider": "^2.0.4",
    "recharts": "^2.4.3",
    "sort-by": "^1.2.0",
    "web-vitals": "^2.1.4",
    "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.2/xlsx-0.19.2.tgz",
    "yup": "^1.0.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@iconify/react": "^4.1.0",
    "assert": "^2.0.0",
    "buffer": "^6.0.3",
    "process": "^0.11.10",
    "stream-http": "^3.2.0",
    "url": "^0.11.0"
  }
}