Troubleshooting Mac OS mcss command error: Env:node\r:no such file or directory

Source: Internet
Author: User

Title No "reprint" is the original article, All rights reserved. Reprint please indicate source: http://besteam.im/blogs/article/31/.

I've always had a sense of resistance to character interfaces, and even with Vim, my Linux scripts (Python/bash script) are usually written and debugged in Windows and then uploaded to Linux.

But when the Linux script is written to run on Linux, it often reports such errors:

$ cat fish.py #!/usr/bin/env python print "Fish" $ chmod u+x fish.py $./fish.py:no such file or directory

Can't find the file? But no matter how to modify the script, there is no way to solve. Cannot find the file, it should be the first line of the ENV command is there a problem? It really makes people feel the head, in fact, this is because of the problem of line break.

We know that a text file under Linux represents a line break with an ASCII code of 10 characters. and Windows uses a continuous 13 and 102 characters. In Python and C \r , a character that represents ASCII 13 is called a carriage return, and the \n ASCII code is 10, which is called a line break. For:

#!/usr/bin/env python\r\n

Such a line of text, the program under Windows is considered to be a #!/usr/bin/env python line. Linux, however, will be considered #! /usr/bin/env python\r a line. So, the mistake just came out, because there is no python\r such document.

There is a strange place, think about it, if the error env should be reported such error message:

/usr/bin/env:python:no such file or directory (Python followed by a carriage return character)

Then why is it now:

: No such file or directory

This is mainly because \r of this character. Under the Linux terminal, the output \r will not show anything, just move the cursor to the beginning of the line. Look at the error message I got from the env output with Python:

/usr/bin/env:python\r:no such file or directory

So the terminal although the output /usr/bin/env: python , but encountered \r , the cursor will be moved to the beginning of the line, and then output the :No such file or directory front of the cover off. So we saw the inexplicable error message.

Maybe someone will blame windows how so silly, a \n not can, why use \r\n it, give us how much trouble. In fact, this is not to blame windows. \r\nThe history of use can be traced back to the distant 19th century. The typewriter, which was invented at that time, was a solid cylinder + a chrysanthemum-like font. The paper is firmly fastened to the surface of the cylinder. When we press a letter, the mechanical device "fly" to the paper, while the ribbon before the cylinder rises, hard to print, so the paper appears on a word. After printing, the mechanism automatically allows the cylinder to move to the left by a letter lattice, which facilitates printing of the next character. After a row, there is a rocker on the left hand side, shake it, the cylinder can scroll a line spacing, this is a newline. However, because the cylinder always moves to the left when typing, the typist also needs to push the cylinder back to the right, which is the legendary return. The usual line-wrapping operation in a computer requires a newline + carriage return of two operations in the typewriter. Naturally, the computer is not so troublesome, but Windows likes to look more compatible. So the change of line became \r\n .

Workaround:

Lookup up:

:set fileformat=unix 
:set fileformat=dos

This can is used on either platform to switch to the other encoding.

Troubleshooting Mac OS mcss command error: Env:node\r:no such file or directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.