wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.86k stars 1.19k forks source link

Wasp doesn't correctly detect failed npm install and continues instead of stopping #2196

Open Martinsos opened 4 months ago

Martinsos commented 4 months ago

We recently had Wasp fail during npm installation due to newest npm (22.5.0) having a bug: https://github.com/wasp-lang/wasp/issues/2195 . This is not wasp specific and was not avoidable. But, what we could have done better is properly handle that. Instead, we reported that npm isntall was successfull in the CLI and continue with the next step, which then failed either on finding tsc command or prisma binary and then it looked as if error is something else really.

We should properly detect when npm install fails and exit at that moment. I thought we are doing it, but it seems we are not. I am not sure if we are not doing it at all, or this is just a case that we somehow didn't handle though, that is what we will have to figure out.

InsOpDe commented 3 weeks ago

same here. i had to manually execute npm install in the app, client and server dir. i have

sodic commented 1 week ago

@InsOpDe Can you please explain in detail what happened?

You should never have to execute npm install manually (regardless of the issue), so your issue sounds a little surprising and we'd love to hear more :)

InsOpDe commented 1 week ago

@sodic mmh I now have developed this routine. wasp start ctrl+c then wasp start again. This is how the log looks like:

❯ wasp start

🐝 --- Starting compilation and setup phase. Hold tight... ------------------------

🐝 --- Compiling wasp project... --------------------------------------------------

[  Wasp  ] Starting npm install
[  Wasp  ] 
[  Wasp  ] up to date, audited 784 packages in 3s
[  Wasp  ] 
[  Wasp  ] 139 packages are looking for funding
[  Wasp  ]   run `npm fund` for details
[  Wasp  ] 
[  Wasp  ] 2 low severity vulnerabilities
[  Wasp  ] 
[  Wasp  ] To address all issues (including breaking changes), run:
[  Wasp  ]   npm audit fix --force
[  Wasp  ] 
[  Wasp  ] Run `npm audit` for details.
[ Client ] Starting npm install
[ Server ] Starting npm install
[ Server ] Still installing npm dependencies!
[ Client ] Still installing npm dependencies!
[ Client ] Installation going great - we'll get there soon!
[ Server ] Installation going great - we'll get there soon!
[ Server ] The installation is taking a while, but we'll get there!
[ Client ] The installation is taking a while, but we'll get there!
[ Client ] Yup, still not done installing.
[ Server ] Yup, still not done installing.
[ Server ] We're getting closer and closer, everything will be installed soon!
[ Client ] We're getting closer and closer, everything will be installed soon!
[ Server ] Still waiting for the installation to finish? You should! We got too far to give up now!
[ Client ] Still waiting for the installation to finish? You should! We got too far to give up now!
[ Server ] You've been waiting so patiently, just wait a little longer (for the installation to finish)...
[ Client ] You've been waiting so patiently, just wait a little longer (for the installation to finish)...^C
❯ wasp start

🐝 --- Starting compilation and setup phase. Hold tight... ------------------------

🐝 --- Compiling wasp project... --------------------------------------------------

[  Wasp  ] Starting npm install
[  Wasp  ] 
[  Wasp  ] up to date, audited 784 packages in 3s
[  Wasp  ] 
[  Wasp  ] 139 packages are looking for funding
[  Wasp  ]   run `npm fund` for details
[  Wasp  ] 
[  Wasp  ] 2 low severity vulnerabilities
[  Wasp  ] 
[  Wasp  ] To address all issues (including breaking changes), run:
[  Wasp  ]   npm audit fix --force
[  Wasp  ] 
[  Wasp  ] Run `npm audit` for details.
[ Client ] Starting npm install
[ Server ] Starting npm install
[ Server ] 
[ Server ] added 132 packages, and audited 133 packages in 2s
[ Server ] 
[ Server ] 23 packages are looking for funding
[ Server ]   run `npm fund` for details
[ Server ] 
[ Server ] 3 high severity vulnerabilities
[ Server ] 
[ Server ] To address all issues (including breaking changes), run:
[ Server ]   npm audit fix --force
[ Server ] 
[ Server ] Run `npm audit` for details.
[ Client ] 
[ Client ] added 82 packages, and audited 83 packages in 3s
[ Client ] 
[ Client ] 11 packages are looking for funding
[ Client ]   run `npm fund` for details
[ Client ] 
[ Client ] found 0 vulnerabilities
✅ --- Successfully completed npm install. ----------------------------------------

🐝 --- Setting up database... -----------------------------------------------------

[   Db   ] [-] Removed tables
[   Db   ]   - PerplexityResponse
[   Db   ] 
[   Db   ] [*] Changed the `PerplexityResponse` table
[   Db   ]   [-] Removed foreign key on columns (userId)
[   Db   ] Environment variables loaded from .env
[   Db   ] Prisma schema loaded from ../db/schema.prisma
[   Db   ] 
[   Db   ] ✔ Generated Prisma Client (v5.19.1) to ./../../../node_modules/@prisma/client in 145ms
[   Db   ] 
✅ --- Database successfully set up. ----------------------------------------------

🐝 --- Building SDK... ------------------------------------------------------------

✅ --- SDK built successfully. ----------------------------------------------------

✅ --- Your wasp project has successfully compiled. -------------------------------

👀 --- [Warning] Your wasp project reported following warnings during compilation: ---

- Your Prisma schema does not match your database, please run `wasp db migrate-dev`.

🐝 --- Listening for file changes... ----------------------------------------------

🐝 --- Starting up generated project... -------------------------------------------

[ Client ] > OpenSaaS@0.0.0 start
[ Client ] > npm run validate-env && vite
[ Client ] 
[ Server ] > server@0.0.0 watch
[ Server ] > nodemon --exec 'npm run bundle-and-start || exit 1'
[ Server ] 
[ Server ] [nodemon] 2.0.22
[ Server ] [nodemon] to restart at any time, enter `rs`
[ Server ] [nodemon] watching path(s): src/**/* ../../../src/**/* .env
[ Server ] [nodemon] watching extensions: ts,mts,js,mjs,json
[ Server ] [nodemon] starting `npm run bundle-and-start || exit 1`
[ Client ] 
[ Client ] > OpenSaaS@0.0.0 validate-env
[ Client ] > node -r dotenv/config ./scripts/validate-env.mjs
[ Client ] 
[ Client ] 🔍 Validating environment variables...
[ Server ] 
[ Server ] > server@0.0.0 bundle-and-start
[ Server ] > npm run bundle && npm run start
[ Server ] 
[ Server ] 
[ Server ] > server@0.0.0 bundle
[ Server ] > rollup --config --silent
[ Server ] 
[ Client ] 
[ Client ]   VITE v5.4.11  ready in 309 ms
[ Client ] 
[ Client ]   ➜  Local:   http://localhost:3000/
[ Client ]   ➜  Network: http://192.168.178.59:3000/
[ Client ]   ➜  Network: http://172.17.0.1:3000/
[ Client ]   ➜  press h + enter to show help
[ Server ] 
[ Server ] > server@0.0.0 start
[ Server ] > npm run validate-env && node --enable-source-maps -r dotenv/config bundle/server.js
[ Server ] 
[ Server ] 
[ Server ] > server@0.0.0 validate-env
[ Server ] > node -r dotenv/config ./scripts/validate-env.mjs
[ Server ] 
[ Server ] 🔍 Validating environment variables...
[ Server ] 🚀 "Email and password" auth initialized
[ Server ] Starting pg-boss...
[ Server ] pg-boss started!
[ Server ] Server listening on port 3001
[ Server ] GET /auth/me 304 39.667 ms - -
[ Server ] POST /operations/update-current-user 200 15.602 ms - 475
[ Server ] GET /auth/me 200 3.820 ms - 625

👀 --- [Warning] Your wasp project reported following warnings during compilation: ---

- Your Prisma schema does not match your database, please run `wasp db migrate-dev`.
sodic commented 1 week ago

@InsOpDe Strange...

Is it maybe possible that it's just a slow connection:

My question is: what happens if you try to wait the first one out? Perhaps it finishes too. Have you tried it?

InsOpDe commented 1 week ago

I have 100 Mbit/s and experience with npm installs. I waited them out and nothing happened for almost 60 minutes.

InsOpDe commented 1 week ago

I have to retract my previous statement. I usually use pnpm and yesterday i installed something with npm and had the same problem. this leads me to the conclusion that its a npm problem (on my side). i.e. wasp didnt do anything wrong :)