我是纯新手,请教node.js的js的文件应该放在哪

我是纯新手,请教node.js的js的文件应该放在哪,第1张

随便放哪里把,比如我有个文件时test.js,内容是console.log(“Hello”),我放在d盘,打开cmd,输入d:,进入d盘,然后node test.js你就会看见控制台出现Hello。

Table of contents

Cross-platform if you want

Paths

Use path.resolve to traverse the filesystem

Use path.normalize to create reliable paths

Use path.join to join folder names

Scripts in package.json

Join shell commands with a double ampersand instead of a semi-colon

Cross Platform Newline Characters

Temporary files

Home directories

Use the os module for more control

Conclusion

References

Cross-platform if you want

Node.js is cross-platform meaning it works on Windows, OSX and Linux. A large number of the Node.js community write Node.js on OSX and then deploy to Linux servers. Because OSX and Linux are based on UNIX this tends to just work. Windows support is a first-class citizen in Node.js and if you learn to use Node.js in the right way you can make sure that you can welcome your Windows friends to your code party.


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11646139.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-17
下一篇 2023-05-17

发表评论

登录后才能评论

评论列表(0条)

保存