简体   繁体   English

sh: /Users/mac/Desktop/LOGIC/node_modules/.bin/react-scripts: /bin/sh^M: 错误的解释器:没有这样的文件或目录

[英]sh: /Users/mac/Desktop/LOGIC/node_modules/.bin/react-scripts: /bin/sh^M: bad interpreter: No such file or directory

How to fix it?如何解决? This error appears, when I run react project当我运行反应项目时出现此错误

sh: /Users/mac/Desktop/LOGIC/node_modules/.bin/react-scripts: /bin/sh^M: bad interpreter: No such file or directory sh: /Users/mac/Desktop/LOGIC/node_modules/.bin/react-scripts: /bin/sh^M: 错误的解释器:没有这样的文件或目录

That looks like an issue with Macintosh line endings.这看起来像是 Macintosh 行尾的问题。 Open the file in an editor like Visual Studio Code and save the file with Unix (LF) line endings.在 Visual Studio Code 等编辑器中打开文件,并以 Unix (LF) 行结尾保存文件。

Please open the file react-scripts in the linux editor and save it.请在 linux 编辑器中打开文件 react-scripts 并保存。 Now repeat the command.现在重复该命令。

The ^M is a carriage return character. ^M 是回车符。 Linux uses the line feed character to mark the end of a line, whereas Windows uses the two-character sequence CR LF. Linux 使用换行符来标记一行的结束,而 Windows 使用双字符序列 CR LF。 Your file has Windows line endings, which is confusing Linux. Remove the cariage character:您的文件有 Windows 行结尾,这是令人困惑的 Linux。删除 cariage 字符:

sed -i -e 's/\r$//' NAME-OF-FILE.sh

From: https://www.folkstalk.com/2022/07/bin-shm-bad-interpreter-with-code-examples.html来自: https://www.folkstalk.com/2022/07/bin-shm-bad-interpreter-with-code-examples.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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