frontendnetwork / veganify

Veganify is a modern webapp that allows you to easily scan EAN barcodes to check if a product is vegan-friendly. With a database of over 3 million products, you can quickly find out if your favorite foods and products are suitable for a vegan diet.
https://veganify.app
MIT License
46 stars 7 forks source link

Local build fails #279

Closed MichalBryxi closed 1 year ago

MichalBryxi commented 1 year ago

Bug description

Can't make the app yarn start locally

Steps to reproduce

Steps to reproduce the behavior:

  1. Git clone my fork via git clone git@github.com:MichalBryxi/vegancheck.me.git
  2. See the installation manual
  3. Run yarn install with success:
    yarn install
    yarn➤ YN0000: ┌ Resolution step
    ➤ YN0000: ⠇ resolve-from@npm:^4.0.0
    ➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
    ➤ YN0061: │ @npmcli/move-file@npm:2.0.1 is deprecated: This functionality has been moved to @npmcli/fs
    ➤ YN0061: │ request@npm:2.88.2 is deprecated: request has been deprecated, see https://github.com/request/request/issues/3142
    ➤ YN0061: │ har-validator@npm:5.1.5 is deprecated: this library is no longer supported
    ➤ YN0061: │ uuid@npm:3.4.0 is deprecated: 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.
    ➤ YN0061: │ rollup-plugin-terser@npm:7.0.2 is deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
    ➤ YN0061: │ @babel/polyfill@npm:7.12.1 is deprecated: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the @babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
    ➤ YN0061: │ sourcemap-codec@npm:1.4.8 is deprecated: Please use @jridgewell/sourcemap-codec instead
    ➤ YN0061: │ core-js@npm:2.6.12 is deprecated: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
    ➤ YN0002: │ eslint-config-sznm@npm:1.1.1 [56ae9] doesn't provide prettier (p84e6e), requested by eslint-plugin-prettier
    ➤ YN0002: │ next-pwa@npm:5.6.0 [56ae9] doesn't provide @babel/core (p89f09), requested by babel-loader
    ➤ YN0002: │ next-pwa@npm:5.6.0 [56ae9] doesn't provide webpack (p2d30c), requested by babel-loader
    ➤ YN0002: │ next-pwa@npm:5.6.0 [56ae9] doesn't provide webpack (pa166f), requested by clean-webpack-plugin
    ➤ YN0002: │ next-pwa@npm:5.6.0 [56ae9] doesn't provide webpack (p7c542), requested by terser-webpack-plugin
    ➤ YN0002: │ next-pwa@npm:5.6.0 [56ae9] doesn't provide webpack (p7a00b), requested by workbox-webpack-plugin
    ➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
    ➤ YN0000: └ Completed in 11s 110ms
    ➤ YN0000: ┌ Fetch step
    ➤ YN0013: │ workbox-strategies@npm:6.5.4 can't be found in the cache and will be fetched from the remote registry
    ➤ YN0013: │ workbox-streams@npm:6.5.4 can't be found in the cache and will be fetched from the remote registry
    ➤ YN0013: │ workbox-sw@npm:6.5.4 can't be found in the cache and will be fetched from the remote registry
    ➤ YN0013: │ workbox-webpack-plugin@npm:6.5.4 can't be found in the cache and will be fetched from the remote registry
    ➤ YN0013: │ workbox-window@npm:6.5.4 can't be found in the cache and will be fetched from the remote registry
    ➤ YN0066: │ typescript@patch:typescript@npm%3A5.0.4#optional!builtin<compat/typescript>::version=5.0.4&hash=1f5320: Cannot apply hunk #4
    ➤ YN0000: └ Completed in 15s 695ms
    ➤ YN0000: ┌ Link step
    ➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
    ➤ YN0007: │ core-js@npm:2.6.12 must be built because it never has been before or the last one failed
    ➤ YN0000: └ Completed in 2s 575ms
    ➤ YN0000: Done with warnings in 29s 505ms
  4. Run yarn start with following errors:
    yarn start
    ready - started server on 0.0.0.0:1030, url: http://localhost:1030
    Error: Could not find a production build in the '/Users/michal/Project/vegancheck.me/.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
    at NextNodeServer.getBuildId (/Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/server/next-server.js:352:23)
    at new Server (/Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/server/base-server.js:146:29)
    at new NextNodeServer (/Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/server/next-server.js:166:9)
    at NextServer.createServer (/Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/server/next.js:167:24)
    at async /Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/server/next.js:187:31
    at async NextServer.prepare (/Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/server/next.js:149:24)
    at async startServer (/Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/server/lib/start-server.js:269:13)
    at async nextStart (/Users/michal/Project/vegancheck.me/.yarn/__virtual__/next-virtual-a5a3f11195/3/.yarn/berry/cache/next-npm-13.3.1-f9884a3d2e-9.zip/node_modules/next/dist/cli/next-start.js:77:5)
  5. Run yarn build with following errors:
    
    yarn build
    info  - Linting and checking validity of types .Failed to compile.

./src/components/Scanner/scanner.tsx:1:34 Type error: Cannot find module 'react' or its corresponding type declarations.

1 | import React, { Component } from "react"; | ^ 2 | import Quagga from "@ericblade/quagga2"; 3 | 4 | interface ScannerProps {

6. Run `next build` with following *errors*:

next build zsh: command not found: next

System

node --version
v18.14.0

yarn --version
4.0.0-rc.38

volta --version
1.1.1

Additional info

Hope this helps. Happy to provide more information if needed.

philipbrembeck commented 1 year ago

Good Morning! That's an odd one. Have you tried it with npm? :)

I can get your repo to build and start with npm and yarn, though I've removed yarn from the origin-repo for now, since I had to deal with some weird "the app builds but does not start up" issues yesterday/today morning.

lwojcik commented 1 year ago

I tried to reproduce this since I still have project on my local machine.

Both npm install and yarn install work fine for me.

I saw the same error as Michal when I didyarn start but only once. I couldn't reproduce it consistently.

When I was translating the project I only used npm run dev and didn't encounter any issues.

macOS 13.3.1 on Intel MBP, node 18.14.2, yarn 1.22.19.

philipbrembeck commented 1 year ago

I'm doing it the same way, mostly using npm run dev, since I'm not building locally..

MichalBryxi commented 1 year ago

Curious. When using npm it works for me, but I have to run npm run build before I can successfully run npm run start. Nuasance and maybe a note in the documentation might be good.

But when trying the same with yarn of versions v4.x, v3.x and v2.x I will get the error from above. Or similar.

But(!) when I pin my yarn version to v1.x it works. To be honest I have no clue what are the problems with yarn@berry+ so not going to patch it against higher version, but pinning it down seems like a good compromise.