docsify-cli: Bug: /usr/bin/env: ‘node\r’: No such file or directory

After the installation, I try to run docsify. However, there’s an error saying /usr/bin/env: ‘node\r’: No such file or directory. Finally, I found the solution to the problem. Just to use dos2unix to convert /use/local/lib/node_modules/docsify-cli/bin/docsify to Unix format. Maybe it is the format(dos) of the file that cause the problem.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 13
  • Comments: 37 (15 by maintainers)

Most upvoted comments

You can simply cd to /usr/local/lib/node_modules/docsify-cli/bin and open docsify with vim sudo vim docsify then you can fix the line endings of the file with :set ff=unix then save and quit :wq and everything should be fine!

By this month for sure !!!

You can simply cd to /usr/local/lib/node_modules/docsify-cli/bin and open docsify with vim sudo vim docsify then you can fix the line endings of the file with :set ff=unix then save and quit :wq and everything should be fine!

Ahh it works thank you much.

If you install it using yarn, the solution of @Rabbitzzc works with additional step

cd ~/.config/yarn/global/node_modules/docsify-cli/bin

Updating using vscode

code docsify

Then in vscode, make sure that the line-ending is set to LF. If not, simply click the CRLF and change to LF. You can see it on the bottom right of the IDE

image

This has blocked several of my users from contributing to our docs.

As a temporary workaround, I published docsify-cli-hotfix which is just a built release of master including this fix.

yarn remove docsify-cli
yarn add --dev docsify-cli-hotfix

Then just use the docsify command normally.

Maintainers, please publish an official patch release for this.

Doing

sudo apt install dos2unix
sudo dos2unix /usr/local/lib/node_modules/docsify-cli/bin/docsify

Fixe it for me. Thx @nsainaney

Yup, lets keep it open until the release

I do use yarn. I downgraded to 4.3.0 to get around the issue

This error occurs only when you use yarn instead of npm to install the package.

yeah, there are also ways to fix it with vim, but we need this cross-platform. 😃

This issue will be fixed as soon the a new version gets launch.

Thanks @anikethsaha for the feedbacks

Will do! Thanks @anikethsaha

I just opened node_modules/.bin/docsify, save the file and It’s works again.

But it’s indeed annoying.

I’m experiencing this issue as well. It’s because the file node_modules/docsify-cli/bin/docsify has CRLF line endings instead of LF (\r instead of \n) with are Windows line endings. You can fix this locally by finding the docsify file locally (which docsify) and changing the line endings using an editor like vscode or something like dos2unix.

I can’t submit a PR because the repo is correct but somehow, the npm package is messed up.

This is what I see for the bin file in vscode. See the highlight in the bottom right:

image