javascript - NodeJs 项目跨系统问题
黄舟
黄舟 2017-04-17 16:31:07
0
2
398

我在 Win7 下写了一个 NodeJs 项目,并把它发布到了 npm 官方仓库中了。然后我在 Ubuntu 下使用 npm install --global package-name 安装后,运行它却显示:/usr/bin/env: "node\r": 没有那个文件或目录,这个应该是因为我的 js 文件第一行:#! /usr/bin/env node,因为在 Windows 下换行符是:\r\n,而在 Linux 下换行符是:\n,所以我该怎么操作才能使这个项目跨系统使用时不会有这个问题呢?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(2)
Ty80

This question has been answered in detail on v2. The final approach is to directly use n as the newline character so that it can be used across systems. .

小葫芦

Editor problem
vs code can set the newline characterrn还是n

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template