nuxt / vercel-builder

Vercel Builder for Nuxt
MIT License
644 stars 76 forks source link

Build error during npm install #794

Open Drewzar opened 1 year ago

Drewzar commented 1 year ago

Hey all, I'm trying to get an initial deployment working for an SSR Nuxt/Vue app through Vercel and running into the following issue.

Build Log:

[17:42:27.495] Running "vercel build"
[17:42:28.053] Vercel CLI 28.16.6
[17:42:28.231] WARN! Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
[17:42:28.243] > Installing Builder: @nuxtjs/vercel-builder
[17:42:40.357] [log] Running with @nuxt/vercel-builder version 0.24.0
[17:42:40.357] [log]  ----------------- Prepare build ----------------- 
[17:42:40.357] [log] Downloading files...
[17:42:40.358] [log] Working directory: /vercel/path0
[17:42:40.390] [log] Using npm
[17:42:40.390] [info] Prepare build took: 33.245941 ms
[17:42:40.391] [log]  ----------------- Install devDependencies ----------------- 
[17:42:40.404] Installing dependencies...
[17:42:40.405] Detected `package-lock.json` generated by npm 7+...
[17:43:06.005] 
[17:43:06.005] > qr-scanner-v2@1.0.0 prepare
[17:43:06.005] > husky install
[17:43:06.005] 
[17:43:06.088] husky - Git hooks installed
[17:43:06.126] 
[17:43:06.126] added 1789 packages in 25s
[17:43:06.126] 
[17:43:06.126] 189 packages are looking for funding
[17:43:06.126]   run `npm fund` for details
[17:43:06.158] [info] Install devDependencies took: 25767.28364 ms
[17:43:06.159] [log]  ----------------- Nuxt build ----------------- 
[17:43:06.563] [log] Running nuxt build --standalone --no-lock --config-file "nuxt.config.js" /vercel/path0
[17:43:43.021] [info] Nuxt build took: 36862.513423 ms
[17:43:43.021] [log]  ----------------- Install dependencies ----------------- 
[17:43:43.044] Installing dependencies...
[17:43:43.045] Detected `package-lock.json` generated by npm 7+...
[17:43:50.629] 
[17:43:50.629] > qr-scanner-v2@1.0.0 prepare
[17:43:50.629] > husky install
[17:43:50.629] 
[17:43:50.643] sh: husky: command not found
[17:43:50.645] npm ERR! code 127
[17:43:50.646] npm ERR! path /vercel/path0
[17:43:50.647] npm ERR! command failed
[17:43:50.647] npm ERR! command sh -c -- husky install
[17:43:50.649] 
[17:43:50.649] npm ERR! A complete log of this run can be found in:
[17:43:50.649] npm ERR!     /vercel/.npm/_logs/2023-02-27T01_43_43_379Z-debug-0.log
[17:43:50.667] Error: Command "npm install" exited with 127
[17:43:50.759] 

package.json

{
    "name": "qr-scanner-v2",
    "version": "1.0.0",
    "private": true,
    "engines": {
        "node": ">=16.0.0 <18"
    },
    "scripts": {
        "dev": "nuxt",
        "build": "nuxt build",
        "start": "nuxt start",
        "generate": "nuxt generate",
        "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
        "lint:style": "stylelint \"**/*.{css,scss,sass,html,vue}\" --ignore-path .gitignore",
        "lint:prettier": "prettier --check .",
        "lint": "npm run lint:js && npm run lint:style && npm run lint:prettier",
        "lintfix": "prettier --write --list-different . && npm run lint:js -- --fix && npm run lint:style -- --fix",
        "prepare": "husky install"
    },
    "lint-staged": {
        "*.{js,vue}": "eslint --cache",
        "*.{css,scss,sass,html,vue}": "stylelint",
        "*.**": "prettier --check --ignore-unknown"
    },
    "dependencies": {
        "@nuxtjs/axios": "^5.13.6",
        "clipboard": "^2.0.11",
        "core-js": "^3.19.3",
        "nuxt": "2.15.8",
        "prismjs": "^1.29.0",
        "vue": "^2.6.14",
        "vue-qrcode-reader": "^3.1.1",
        "vue-server-renderer": "^2.6.14",
        "vue-template-compiler": "^2.6.14",
        "vuetify": "^2.6.1",
        "webpack": "^4.46.0"
    },
    "devDependencies": {
        "@babel/eslint-parser": "^7.16.3",
        "@babel/plugin-proposal-class-properties": "^7.18.6",
        "@babel/plugin-proposal-decorators": "^7.20.13",
        "@babel/plugin-transform-runtime": "^7.19.6",
        "@nuxtjs/eslint-config": "^8.0.0",
        "@nuxtjs/eslint-module": "^3.0.2",
        "@nuxtjs/stylelint-module": "^4.1.0",
        "@nuxtjs/vuetify": "^1.12.3",
        "eslint": "^8.4.1",
        "eslint-config-prettier": "^8.3.0",
        "eslint-plugin-nuxt": "^3.1.0",
        "eslint-plugin-prettier": "^4.2.1",
        "eslint-plugin-vue": "^8.2.0",
        "husky": "^7.0.4",
        "lint-staged": "^12.1.2",
        "postcss-html": "^1.3.0",
        "prettier": "^2.5.1",
        "stylelint": "^14.1.0",
        "stylelint-config-prettier": "^9.0.3",
        "stylelint-config-recommended-vue": "^1.1.0",
        "stylelint-config-standard": "^24.0.0"
    }
}

vercel.json

{
    "builds": [
        {
            "src": "nuxt.config.js",
            "use": "@nuxtjs/vercel-builder",
            "config": {}
        }
    ]
}

Feel free to let me know if you need any more information to be helpful.

DidoMarchet commented 1 year ago

Hi, same error

Screenshot 2023-02-27 at 12 38 19
DidoMarchet commented 1 year ago

Hi, I solved this issue following these steps:

I use node@16. And when I push to vercel I don't send the package-lock.json to avoid error like Serverless function > 50.

I hope it can be helpful. Thanks and regards,

Davide

Drewzar commented 1 year ago

Hey @DidoMarchet, thanks for the update, but I don't believe this relates to my issue.

DidoMarchet commented 1 year ago

Hey @DidoMarchet, thanks for the update, but I don't believe this relates to my issue.

Ok!

nachoadjust commented 1 year ago

Hello! Did you manage to fix the issue? We are facing a similar problem and I have no idea where to start to fix it.

In my case, we want to get a Vercel cronjob to run but seems vercel-builder's config gets in the way.

This config worked for us, and built the project successfully:

"builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder@0.22.1", // we had to lock it in 0.22.1 cos newer versions were crashing the builds.
      "config": {
        "internalServer": true,
        "serverFiles": [ your files here ]
      }
    },
  ],

However, this seems to be stopping calls getting through to api/crons.js, for example. And any modification to the builds object, breaks the builds with the same error you get.