wasp-lang / wasp

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

Fixes missing `node_modules` causing errors #2139

Open infomiho opened 4 days ago

infomiho commented 4 days ago

Reproduce the bug

  1. wasp new todo
  2. cd todo
  3. wasp compile
  4. rm -rf node_modules
  5. wasp compile

I get this error:


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

✅ --- Successfully completed npm install. ----------------------------------------

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

✅ --- Database successfully set up. ----------------------------------------------

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

[  Wasp  ]
[  Wasp  ]
[  Wasp  ]                 This is not the tsc command you are looking for
[  Wasp  ]
[  Wasp  ]
[  Wasp  ] To get access to the TypeScript compiler, tsc, from the command line either:
[  Wasp  ]
[  Wasp  ] - Use npm install typescript to first add TypeScript to your project before using npx
[  Wasp  ] - Use yarn to avoid accidentally running code from un-installed packages

❌ --- [Error] Your wasp project failed to compile: -------------------------------

- SDK build failed with exit code: 1

❌ --- [Error] Compilation of wasp project failed: --------------------------------

1 errors found

Under certain circumstances (deleting the Prisma checksum file) I would get this as well:

wasp compile

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

✅ --- Successfully completed npm install. ----------------------------------------

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

wasp-bin: /private/tmp/xxx/node_modules/.bin/prisma: streamingProcess: exec: invalid argument (Bad file descriptor)

Why it happens

If the npm deps cache file says we are up to date, we assume that the node_modules exists. This results in a crash. The node_modules dir might get deleted by accident by some users while debugging their app.