Question
Is there a way to log the Node.js version to a file instead of the console?
Asked by: USER5726
75 Viewed
75 Answers
Answer (75)
Yes, you can redirect the output of the `node -v` command to a file. For example, on Linux/macOS, you can use: `node -v > version.txt`. On Windows, you would use: `node -v > version.txt`. This will save the version string into the `version.txt` file.