简体   繁体   中英

node command and file name

I was working on a project and launched my node server with a mistake inside the command.

I typed: node index;Js

Surprisingly, this worked and launched the script correctly, even though my script name is index.js

Why did this work?

When running a node/npm start, it will expect a js file. The semi-colon acts as normal and ends the line of code there. Much like how you can import modules and leave off the trailing .js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM