Vercel production doesn't work

Hey!

I have a Vercel project that doesn’t work anymore.
None of my new push makes a successful deployment, and I can’t even re-deploy the successful past doesn’t work anymore.

I also tried to restart everything from scratch:

  • git clone the repo
  • npm install, it works fine
  • add the .env
  • npm run build, it works fine
  • npm run dev, it works fine and I can use the app
  • add a vercel.local.json with basic npm install and npm run build
  • vercel build --local-config vercel.local.json , it works fine
  • vercel build, it works fine
  • vercel --prod, it doesn’t work…

I have this error

➜  interface git:(main) ✗ vercel --prod

Vercel CLI 37.6.3
🔍  Inspect: https://vercel.com/my-project/interface/EqaruNjbUqXnP7XsGHdftGpY4h4J [2s]
✅  Production: https://interface-5dumy5bf8-my-project.vercel.app [2s]
Error: Command "npm install" exited with 1
Error: Check your logs at https://interface-5dumy5bf8-my-project.vercel.app/_logs or run `vercel logs interface-5dumy5bf8-my-project.vercel.app`

Why???

What do you see in the build logs or vercel --prod output? That should tell you details about the error preventing this build.

[15:01:39.545] Running build in Washington, D.C., USA (East) – iad1
[15:01:39.644] Retrieving list of deployment files...
[15:01:39.950] Previous build cache not available
[15:01:40.179] Downloading 220 deployment files...
[15:01:41.186] Running "vercel build"
[15:01:41.607] Vercel CLI 37.6.1
[15:01:42.011] Running "install" command: `npm install`...
[15:01:50.880] npm warn deprecated npmlog@6.0.2: This package is no longer supported.
[15:01:51.536] npm warn deprecated multiaddr@8.1.2: This module is deprecated, please upgrade to @multiformats/multiaddr
[15:01:51.639] npm warn deprecated multibase@3.1.2: This module has been superseded by the multiformats module
[15:01:52.236] npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
[15:01:52.467] npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
[15:01:52.962] npm warn deprecated eslint-config-standard-with-typescript@43.0.1: Please use eslint-config-love, instead.
[15:01:53.048] npm warn deprecated gauge@4.0.4: This package is no longer supported.
[15:01:53.233] npm warn deprecated multicodec@2.1.3: This module has been superseded by the multiformats module
[15:01:53.273] npm warn deprecated dgram@1.0.1: npm is holding this package for security reasons. As it's a core Node module, we will not transfer it over to other users. You may safely remove the package from your dependencies.
[15:01:54.112] npm warn deprecated cids@1.1.9: This module has been superseded by the multiformats module
[15:01:54.432] npm warn deprecated are-we-there-yet@3.0.1: This package is no longer supported.
[15:01:56.828] npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
[15:01:58.346] npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
[15:01:58.346] npm warn deprecated @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
[15:01:59.694] npm warn deprecated @babel/plugin-proposal-nullish-coalescing-operator@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
[15:01:59.695] npm warn deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
[15:01:59.790] npm warn deprecated @babel/plugin-proposal-optional-chaining@7.21.0: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
[15:02:00.309] npm warn deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
[15:02:00.887] npm warn deprecated @motionone/vue@10.16.4: Motion One for Vue is deprecated. Use Oku Motion instead https://oku-ui.com/motion
[15:02:01.378] npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[15:02:02.206] npm warn deprecated multibase@4.0.6: This module has been superseded by the multiformats module
[15:02:02.298] npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[15:02:02.748] npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[15:02:02.748] npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[15:02:03.495] npm warn deprecated multibase@4.0.6: This module has been superseded by the multiformats module
[15:02:03.966] npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
[15:02:04.303] npm warn deprecated multicodec@3.2.1: This module has been superseded by the multiformats module
[15:02:08.847] npm warn deprecated eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
[15:02:37.885] npm warn cleanup Failed to remove some directories [
[15:02:37.885] npm warn cleanup   [
[15:02:37.885] npm warn cleanup     '/vercel/path0/node_modules/ursa-optional',
[15:02:37.885] npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/vercel/path0/node_modules/ursa-optional'] {
[15:02:37.885] npm warn cleanup       errno: -39,
[15:02:37.885] npm warn cleanup       code: 'ENOTEMPTY',
[15:02:37.885] npm warn cleanup       syscall: 'rmdir',
[15:02:37.885] npm warn cleanup       path: '/vercel/path0/node_modules/ursa-optional'
[15:02:37.885] npm warn cleanup     }
[15:02:37.886] npm warn cleanup   ],
[15:02:37.886] npm warn cleanup   [
[15:02:37.886] npm warn cleanup     '/vercel/path0/node_modules',
[15:02:37.886] npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/vercel/path0/node_modules/ursa-optional'] {
[15:02:37.886] npm warn cleanup       errno: -39,
[15:02:37.886] npm warn cleanup       code: 'ENOTEMPTY',
[15:02:37.886] npm warn cleanup       syscall: 'rmdir',
[15:02:37.886] npm warn cleanup       path: '/vercel/path0/node_modules/ursa-optional'
[15:02:37.886] npm warn cleanup     }
[15:02:37.886] npm warn cleanup   ]
[15:02:37.886] npm warn cleanup ]
[15:02:37.890] npm error code 1
[15:02:37.890] npm error path /vercel/path0/node_modules/bcrypto
[15:02:37.890] npm error command failed
[15:02:37.890] npm error command sh -c node-gyp rebuild
[15:02:37.890] npm error gyp info it worked if it ends with ok
[15:02:37.890] npm error gyp info using node-gyp@8.4.1
[15:02:37.890] npm error gyp info using node@20.17.0 | linux | x64
[15:02:37.890] npm error gyp info find Python using Python version 3.12.2 found at "/usr/local/bin/python3"
[15:02:37.890] npm error gyp http GET https://nodejs.org/download/release/v20.17.0/node-v20.17.0-headers.tar.gz
[15:02:37.890] npm error gyp http 200 https://nodejs.org/download/release/v20.17.0/node-v20.17.0-headers.tar.gz
[15:02:37.890] npm error gyp http GET https://nodejs.org/download/release/v20.17.0/SHASUMS256.txt
[15:02:37.891] npm error gyp http 200 https://nodejs.org/download/release/v20.17.0/SHASUMS256.txt
[15:02:37.891] npm error gyp info spawn /usr/local/bin/python3
[15:02:37.891] npm error gyp info spawn args [
[15:02:37.891] npm error gyp info spawn args   '/vercel/path0/node_modules/node-gyp/gyp/gyp_main.py',
[15:02:37.891] npm error gyp info spawn args   'binding.gyp',
[15:02:37.891] npm error gyp info spawn args   '-f',
[15:02:37.891] npm error gyp info spawn args   'make',
[15:02:37.891] npm error gyp info spawn args   '-I',
[15:02:37.891] npm error gyp info spawn args   '/vercel/path0/node_modules/bcrypto/build/config.gypi',
[15:02:37.891] npm error gyp info spawn args   '-I',
[15:02:37.891] npm error gyp info spawn args   '/vercel/path0/node_modules/node-gyp/addon.gypi',
[15:02:37.892] npm error gyp info spawn args   '-I',
[15:02:37.892] npm error gyp info spawn args   '/vercel/.cache/node-gyp/20.17.0/include/node/common.gypi',
[15:02:37.892] npm error gyp info spawn args   '-Dlibrary=shared_library',
[15:02:37.892] npm error gyp info spawn args   '-Dvisibility=default',
[15:02:37.892] npm error gyp info spawn args   '-Dnode_root_dir=/vercel/.cache/node-gyp/20.17.0',
[15:02:37.892] npm error gyp info spawn args   '-Dnode_gyp_dir=/vercel/path0/node_modules/node-gyp',
[15:02:37.892] npm error gyp info spawn args   '-Dnode_lib_file=/vercel/.cache/node-gyp/20.17.0/<(target_arch)/node.lib',
[15:02:37.892] npm error gyp info spawn args   '-Dmodule_root_dir=/vercel/path0/node_modules/bcrypto',
[15:02:37.892] npm error gyp info spawn args   '-Dnode_engine=v8',
[15:02:37.892] npm error gyp info spawn args   '--depth=.',
[15:02:37.892] npm error gyp info spawn args   '--no-parallel',
[15:02:37.892] npm error gyp info spawn args   '--generator-output',
[15:02:37.893] npm error gyp info spawn args   'build',
[15:02:37.893] npm error gyp info spawn args   '-Goutput_dir=.'
[15:02:37.893] npm error gyp info spawn args ]
[15:02:37.893] npm error Traceback (most recent call last):
[15:02:37.893] npm error   File "/vercel/path0/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
[15:02:37.893] npm error     import gyp  # noqa: E402
[15:02:37.893] npm error     ^^^^^^^^^^
[15:02:37.893] npm error   File "/vercel/path0/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
[15:02:37.893] npm error     import gyp.input
[15:02:37.893] npm error   File "/vercel/path0/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
[15:02:37.893] npm error     from distutils.version import StrictVersion
[15:02:37.893] npm error ModuleNotFoundError: No module named 'distutils'
[15:02:37.893] npm error gyp ERR! configure error 
[15:02:37.893] npm error gyp ERR! stack Error: `gyp` failed with exit code: 1
[15:02:37.893] npm error gyp ERR! stack     at ChildProcess.onCpExit (/vercel/path0/node_modules/node-gyp/lib/configure.js:259:16)
[15:02:37.893] npm error gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
[15:02:37.893] npm error gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
[15:02:37.893] npm error gyp ERR! System Linux 5.10.174
[15:02:37.893] npm error gyp ERR! command "/node20/bin/node" "/vercel/path0/node_modules/.bin/node-gyp" "rebuild"
[15:02:37.893] npm error gyp ERR! cwd /vercel/path0/node_modules/bcrypto
[15:02:37.893] npm error gyp ERR! node -v v20.17.0
[15:02:37.893] npm error gyp ERR! node-gyp -v v8.4.1
[15:02:37.893] npm error gyp ERR! not ok
[15:02:37.893] npm error A complete log of this run can be found in: /vercel/.npm/_logs/2024-10-09T13_01_42_119Z-debug-0.log
[15:02:37.951] Error: Command "npm install" exited with 1
[15:02:38.158] 

:thinking: Was the project always built with Python 3.12? If it used to be deployed with an earlier version, that would explain some of the errors

A change in packages versions, similarly, could cause some of these errors.

Or an incompatibility between the Python and Node.js versions could be the culprit. In that case you could change the Node.js version in project settings from 20.x to 18.x and redeploy to test this idea.

Please give those ideas a try and let me know if you still have trouble with the build :pray:

It’s a NextJS project, so there shouldn’t even use python, or it’s not on my end

You’re right, recently I changed the version from 18x to 20.x
But it’s because when I write node -von my computer, it tells me that It’s v20.17.0

Ok I just changed back to 18x

And it works!!!
I mean it works on my new Vercel project

On my original project, I noticed that I recently added an Environment Variables “NODE_ENV”, with “production” value.
It broke everything…
So I removed it too, deployed, and it worked!!
But I can’t figure out why?? Do you have an explanation?

1 Like

That’s great news! :smile:

I’m not sure why the app would break when you add a NODE_ENV variable. I know you shouldn’t need to set it manually since it should be automatically handled for you. There’s also a VERCEL_ENV variable automatically included in case you need to know need to check the environment in your code.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.