foundersandcoders / coursebook

The new coursebook
https://learn.foundersandcoders.com
Other
50 stars 23 forks source link

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

Open halimahexe opened 5 months ago

halimahexe commented 5 months 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 5 months 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