Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: /usr/bin/env: ‘node\r’: No such file or directory #78

Closed
BioniCosmos opened this issue Dec 7, 2019 · 37 comments
Closed

Bug: /usr/bin/env: ‘node\r’: No such file or directory #78

BioniCosmos opened this issue Dec 7, 2019 · 37 comments

Comments

@BioniCosmos
Copy link

BioniCosmos commented Dec 7, 2019

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.

@BioniCosmos
Copy link
Author

Please fix it!

@nsainaney
Copy link

nsainaney commented Dec 7, 2019

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

@anikethsaha
Copy link
Member

Are you guys on the latest version?
Might be, cause I published from my windows machine but it's weird as I never faced this type of bugs.

@jamesgeorge007 Can you take a look here.

@nsainaney
Copy link

nsainaney commented Dec 7, 2019

Yes I'm on 4.4.0. On a Linux/MacOS machine, the following shows that the bin/docsify file uses CRLF:

npm pack docsify-cli
tar -xf docsify-cli-4.4.0.tgz
code package/bin/docsify

The above downloads the docsify-cli tarball from npm and unpacks the contents and finally, opens it in VSCode. The file shows CRLF line endings.

The issue could be because it's published using a Windows machine. Git is probably converting CRLF's to LF's which is why the repo file is fine. It's just the published file in the bin folder.

PS: I've never encountered this before either. Learn something new every day! 😀

@anikethsaha
Copy link
Member

@felangel if it's possible can you do a patch release if you have a linux/MacOS system !

@CN-GuoZiyang
Copy link

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!

@raulfdm
Copy link
Contributor

raulfdm commented Dec 22, 2019

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

But it's indeed annoying.

@anikethsaha
Copy link
Member

@jamesgeorge007 could you do a patch release soon.

@raulfdm
Copy link
Contributor

raulfdm commented Dec 22, 2019

I was taking a look on the project structure, does it makes sense to have a sort of index.js or main.js and runs a tool like rollup (very basic config) to avoid this kind of problem?

@anikethsaha
Copy link
Member

yeah...that's a good option to have proper build steps and automatic releases.
I would say we can just wait for a while until @jamesgeorge007 finishes his work of adding e2e. Then we can add these build systems.
Feel free to submit an issue and we can discuss that there separately.

@raulfdm
Copy link
Contributor

raulfdm commented Dec 22, 2019

Will do! Thanks @anikethsaha

@raulfdm
Copy link
Contributor

raulfdm commented Dec 22, 2019

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

Thanks @anikethsaha for the feedbacks

@owenkellogg
Copy link

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.

@raulfdm
Copy link
Contributor

raulfdm commented Dec 29, 2019

@DeeperDing Why is this closed if a there's no new release to fix the issue? 🤔

@anikethsaha anikethsaha reopened this Dec 29, 2019
@anikethsaha
Copy link
Member

Yup, lets keep it open until the release

@nsainaney
Copy link

nsainaney commented Dec 30, 2019 via email

@anikethsaha
Copy link
Member

That's really helpful 🎉
But as of now, you can see that we don't have much of tests in both the repos to get the confidence. So our first priority here is to increase the coverage and test cases.
I am actually thinking of CI piped release but that through GitHub action as this can be more trustful.

@woss
Copy link

woss commented Jan 24, 2020

none of the solutions work if you install it via volta

@mattiasrunge
Copy link

When will a new release with this fix be available?

@anikethsaha
Copy link
Member

By this month for sure !!!

@jamesgeorge007 jamesgeorge007 removed their assignment Feb 14, 2020
@FredericGuilbault
Copy link

Doing

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

Fixe it for me.
Thx @nsainaney

@woss
Copy link

woss commented Feb 15, 2020

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

@suazithustra
Copy link

for me, only seems to happen when installed globally with yarn

@hipstersmoothie
Copy link

Adding docsify to a new project and can't get it to work at all 😢

@anikethsaha
Copy link
Member

Adding docsify to a new project and can't get it to work at all 😢

@hipstersmoothie can you describe your issue ? is it related to the CLI ?

also, if CLI is not working propoerly , then adding the docsify 's js and css files from cdn to your html page and create a div with app class and you have docsify ready to use. Use window.$docsify object to configure it !

@shankara403
Copy link

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

@hipstersmoothie
Copy link

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

@saurabhnemade
Copy link

Any eta on this? Looking forward to use it.

@anikethsaha
Copy link
Member

anikethsaha commented Mar 13, 2020

Any eta on this? Looking forward to use it.

Cant say!

@sapkra
Copy link

sapkra commented Apr 7, 2020

@anikethsaha I've created a PR which will hopefully fix it. #102

@Rabbitzzc
Copy link

Rabbitzzc commented Apr 9, 2020

if you use yarn

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

and open the code with vscode and delete the last line break


if you use nvm & npm

go to the global node_modules

and open the code with vscode and delete the last line break

@adrianmcli
Copy link

Strangely enough, the vim method didn't work for me but dos2unix did. It's also important to point out that node_modules/.bin/docsify is a symlink towards node_modules/docsify-cli/bin/docsify.

For best results:

brew install dos2unix
sudo dos2unix ./node_modules/docsify-cli/bin/docsify

@transitive-bullshit
Copy link

transitive-bullshit commented Apr 21, 2020

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.

@anikethsaha
Copy link
Member

it will be done soon. sorry for the delay.
we have an open PR for this and there are few things that need to be fixed before release.
also, how this is effecting from contributing? if this is about serve command, then you can use live-server to serve the files/folder as our CLI does that under the hood.

@jkga
Copy link

jkga commented Apr 23, 2020

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

@azl397985856
Copy link

annoying problem

@xamantra
Copy link

Doing

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

Fixe it for me.
Thx @nsainaney

This solution worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.