Pm2 command line startup-- env parameter setting usage problem

individuals want to use pm2 to start the application using -- env parameters to specify some application variables. Check the document -- env usage can be set to a object . It is also written in this article . Here"s how I write it:

pm2 start --name=ProjectName --env {"NODE_ENV":"Test","PORT":"3000"} ./bin/www

pm2 start --name=ProjectName --env={"NODE_ENV":"Test","PORT":"3000"} ./bin/www    

www  express 
pm2 start --name=ProjectName --env={"NODE_ENV":"Test","PORT":"3000"} node ./bin/www
`node`

the application can be started, but NODE_ENV and PORT are not set successfully. Use process.env to view and do not see these two parameters.
officially provides a way to set env in the configuration file, which is OK. Now I just want to try whether it is possible to directly put it in the command. I wonder if there is something wrong with my writing. Ask for advice.


landlord, is there a problem with understanding? -- env is followed by a string, such as development or production , to specify the environment to get a specific env variable (the JSON environment variable used for declaration) . It is used in conjunction with the defined configuration document .

clipboard.png

Menu