Skip to content
Advertisement

Error! Command “npm run build” exited with 1, while deploying a website using vercel command

I am trying to deploy a website on vercel from my command line of VSCode by using the command:

vercel

When I execute this command, I get this output: error output

If I run:

vercel logs demo-minting-frontend-rga7f9q73-hemang-h.vercel.app

I get the output as follow:

PS C:CSThree.jsMarketplace-threeSelf-coded-creation> vercel logs demo-minting-frontend-rga7f9q73-hemang-h.vercel.app
Vercel CLI 24.0.0
> Fetched deployment "demo-minting-frontend-rga7f9q73-hemang-h.vercel.app" in hemang-h [1s]
2022-03-07T15:36:56.106Z  
2022-03-07T15:36:56.112Z  Retrieving list of deployment files...
2022-03-07T15:36:57.506Z  Downloading 49 deployment files...
2022-03-07T15:36:58.268Z  Analyzing source code...
2022-03-07T15:36:58.657Z  Installing build runtime...
2022-03-07T15:37:01.398Z  Build runtime installed: 2.741s
2022-03-07T15:37:02.062Z  Looking up build cache...
2022-03-07T15:37:05.865Z  Build cache downloaded [87.05 MB]: 3377.740ms
2022-03-07T15:37:06.003Z  Detected package.json
2022-03-07T15:37:06.004Z  Installing dependencies...
2022-03-07T15:37:06.011Z  Detected `package-lock.json` generated by npm 7...
2022-03-07T15:37:07.781Z  npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
2022-03-07T15:37:08.047Z  
2022-03-07T15:37:08.048Z  added 1 package, and changed 1 package in 2s
2022-03-07T15:37:08.048Z
2022-03-07T15:37:08.048Z  116 packages are looking for funding
2022-03-07T15:37:08.048Z    run `npm fund` for details
2022-03-07T15:37:08.257Z  Detected `package-lock.json` generated by npm 7...
2022-03-07T15:37:08.257Z  Running "npm run build"
2022-03-07T15:37:08.537Z
2022-03-07T15:37:08.537Z  > demo-minting-page@1.0.0 build
2022-03-07T15:37:08.537Z  > next build
2022-03-07T15:37:08.537Z
2022-03-07T15:37:09.158Z  warn  - SWC minify release candidate enabled. https://nextjs.org/docs/messages/swc-minify-enabled
2022-03-07T15:37:09.177Z  Attention: Next.js now collects completely anonymous telemetry regarding usage.
2022-03-07T15:37:09.177Z  This information is used to shape Next.js' roadmap and prioritize features.
2022-03-07T15:37:09.177Z  You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following 
URL:
2022-03-07T15:37:09.177Z  https://nextjs.org/telemetry
2022-03-07T15:37:09.177Z
2022-03-07T15:37:09.218Z  info  - Checking validity of types...
2022-03-07T15:37:11.594Z
2022-03-07T15:37:11.594Z  Failed to compile.
2022-03-07T15:37:11.595Z
2022-03-07T15:37:11.595Z  ./pages/404.js
2022-03-07T15:37:11.595Z  18:9  Warning: passHref is missing. See: https://nextjs.org/docs/messages/link-passhref  @next/next/link-passhref
2022-03-07T15:37:11.595Z
2022-03-07T15:37:11.595Z  ./pages/Landing.js
2022-03-07T15:37:11.595Z  6:10  Error: 'Text' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.595Z  6:16  Error: 'Flex' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.595Z  7:10  Error: 'useState' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.596Z  13:5  Error: 'success' is assigned a value but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.596Z  15:5  Error: 'owned' is assigned a value but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.596Z  16:5  Error: 'owner' is assigned a value but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.596Z  26:5  Error: 'reset' is assigned a value but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.596Z
2022-03-07T15:37:11.596Z  ./pages/index.js
2022-03-07T15:37:11.596Z  92:11  Warning: passHref is missing. See: https://nextjs.org/docs/messages/link-passhref  @next/next/link-passhref
2022-03-07T15:37:11.596Z  182:11  Warning: passHref is missing. See: https://nextjs.org/docs/messages/link-passhref  @next/next/link-passhref
2022-03-07T15:37:11.596Z
2022-03-07T15:37:11.596Z  ./pages/mint.js
2022-03-07T15:37:11.597Z  1:30  Error: 'SimpleGrid' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.597Z  1:42  Error: 'Divider' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.597Z  3:8  Error: 'Section' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.597Z  4:10  Error: 'WorkGridItem' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.598Z  11:28  Error: React Hook "useWeb3Modal" is called in function "mint" that is neither a React function component nor a custom React 
Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use".  react-hooks/rules-of-hooks       
2022-03-07T15:37:11.598Z
2022-03-07T15:37:11.598Z  ./components/grid-item.js
2022-03-07T15:37:11.598Z  26:5  Warning: passHref is missing. See: https://nextjs.org/docs/messages/link-passhref  @next/next/link-passhref
2022-03-07T15:37:11.598Z
2022-03-07T15:37:11.598Z  ./components/mint.js
2022-03-07T15:37:11.598Z  3:30  Error: 'VStack' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.598Z  3:52  Error: 'Link' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.598Z  3:58  Error: 'Text' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.599Z  3:64  Error: 'Spacer' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.599Z  5:33  Error: 'IoMdOpen' is defined but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.599Z  8:41  Error: 'loading' is assigned a value but never used. Allowed unused vars must match /^_/u.  no-unused-vars
2022-03-07T15:37:11.599Z  
2022-03-07T15:37:11.599Z  info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
2022-03-07T15:37:11.616Z  Error: Command "npm run build" exited with 1
2022-03-07T15:37:12.463Z

Now, just to say that I tried solving the warnings, I ran:

npm install uuid

to install the latest uuid version, so that I can bypass the first warning. But It didn’t helped either. I again executed vercel command, and there were similar logs.

I tried to override the build settings to CI=False on vercel, under the project settings, but still didn’t got any successful response.

My package.json looks like this:

{
  "name": "demo-minting-page",
  "version": "1.0.0",
  "description": "TokenMinds Demo ",
  "scripts": {
    "dev": "next dev -H 0.0.0.0",
    "prettier": "prettier -write .",
    "lint": "next lint",
    "build": "next build",
    "start": "next start"
  },
  "keywords": [],
  "author": "Hemang Joshi",
  "license": "MIT",
  "dependencies": {
    "@chakra-ui/icons": "^1.1.7",
    "@chakra-ui/react": "^1.8.6",
    "@emotion/react": "^11.8.1",
    "@emotion/styled": "^11.8.1",
    "ethers": "^5.5.4",
    "framer-motion": "^6.2.8",
    "merkletreejs": "^0.2.30",
    "react-icons": "^4.3.1",
    "react-toastify": "^8.2.0",
    "three": "^0.138.3",
    "uuid": "^8.3.2",
    "web3": "^1.7.1",
    "web3modal": "^1.9.5",
    "zustand": "^3.7.1"
  },
  "devDependencies": {
    "eslint": "^8.9.0",
    "eslint-config-next": "^12.1.0",
    "prettier": "^2.5.1",
    "webpack": "^5.70.0"
  }
}

.eslintrc.json looks like this:

{
    "root": true,
    "extends": "next",
    "rules": {
       "plugin":[
            
                "react/recommended"
            
       ],
              "no-unused-vars": [
        "error",
        {
          "argsIgnorePattern": "^_",
          "varsIgnorePattern": "^_"
        }
      ],
      "react/display-name": 0
    }
}

Link to my full github repository where I am holding this code is: Github repo

Kindly please help me out, what should I do.

P.S:- Everything is working very smoothly on my localhost:3000, and there are not bugs on it. I have ran the npm run dev several times on my terminal now, but there are no complaints on the localhost.

Advertisement

Answer

There are 2 ways to fix this problem.

  1. It seems that you are importing modules to some js files but not using them so avoid using unnecessary imports and only import a module when you are using it on the page. If you are not using it then avoid importing that module to the js file.

  1. Install the following module npm install --save-dev eslint-plugin-react. (for developers using NPM) or yarn add --dev eslint-plugin-react. (for developers using Yarn)

    Then, in your .eslintrc.json, under extends, include the following plugin:

    'extends': [
        'plugin:react/recommended'
    ]
    

Hopefully, your error will resolve if you use any of this up suggestions

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement