.env not working in node.js server

Hey there! I’m trying to create a system that sets a cookie to an env file, but it’s not working. I’ve double checked my spelling/code and that it actually worked, and it hasn’t. I’ve tried making it a variable in the script, and it worked, but I want to be in the .env file so it’s hidden.

Code:

function login(){
  noblox.setCookie(process.env.cookie);
}

login();

My console also says:
.env: command not found

Any help will be appreciated :slight_smile:

When I try to console.log it, it shows ‘undefined’

Are you trying to do this via the Javascript browser, or on your server.js file?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.