foundersandcoders / coursebook

The new coursebook
https://learn.foundersandcoders.com
Other
49 stars 21 forks source link

Couldn't set Node variables in Windows terminal [learn/database] #974

Open halimahexe opened 1 month ago

halimahexe commented 1 month ago

For some reason, despite looking up the correct way to set Node variables in a Windows terminal, I wasn't able to do so in the terminal. Instead I had to install dotenv, create a .env file and put require('dotenv').config() in my code. It might be worth highlighting this to other Windows users.

halimahexe commented 1 month ago

I've actually worked out that I was using the wrong command for Powershell. It should be:

$env:DB_FILE='db.sqlite'; node database/db.js

or

$env:DB_FILE='test.sqlite'; node test/tasks.test.js