Igal
Igal

Reputation: 6103

Creating new file with Node.js and Express

I'm trying to learn how to use Node.js and its packages. I'm in my Command Prompt (I'm on Windows), changed directory to my project folder. Then I installed the Express package:

npm install express --save

The npm installed the Express package. Now, while I'm still in the directory, I'm trying to create a new file:

touch index.js

But the file isn't created and I'm getting the following message:

'touch' is not recognized as an internal or external command, operable program or batch file.

Why is that? What am I doing wrong?

Upvotes: 1

Views: 1037

Answers (2)

moonwave99
moonwave99

Reputation: 22812

touch is no Windows command.

In this answer, they suggest this as an equivalent:

echo $null >> filename

Upvotes: 1

Ethan Brown
Ethan Brown

Reputation: 27282

touch is a Unix command that creates an empty file (or updates its timestamp if it doesn't exist). It has nothing to do with Node specifically.

Most Unix distributions (including OSX) will have touch installed by default. So I suspect you're on a Windows machine....

Upvotes: 0

Related Questions