簡體   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

如何解決? 當我運行反應項目時出現此錯誤

sh: /Users/mac/Desktop/LOGIC/node_modules/.bin/react-scripts: /bin/sh^M: 錯誤的解釋器:沒有這樣的文件或目錄

這看起來像是 Macintosh 行尾的問題。 在 Visual Studio Code 等編輯器中打開文件,並以 Unix (LF) 行結尾保存文件。

請在 linux 編輯器中打開文件 react-scripts 並保存。 現在重復該命令。

^M 是回車符。 Linux 使用換行符來標記一行的結束,而 Windows 使用雙字符序列 CR LF。 您的文件有 Windows 行結尾,這是令人困惑的 Linux。刪除 cariage 字符:

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

來自: 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