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

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

Closed
giancarlocp opened this issue May 9, 2018 · 9 comments
Closed

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

giancarlocp opened this issue May 9, 2018 · 9 comments

Comments

@giancarlocp
Copy link

giancarlocp commented May 9, 2018

I am on linux, and i use yarn to install it.
$ yarn global add create-mithril-app
It is installed in:

~/.config/yarn/global/node_modules/create-mithril-app
├── deployapi.js
├── index.js
├── node_modules
├── package.json
├── README.md
├── roadmap.md
├── sampleAPI
│   ├── index.js
│   └── package.json
├── sampleApp
│   ├── client
│   │   ├── index.js
│   │   ├── MainView.js
│   │   └── model.js
│   ├── package.json
│   ├── public
│   │   ├── favicon.ico
│   │   ├── favicon.png
│   │   └── index.html
│   ├── README.md
│   ├── webpack.build.js
│   └── webpack.dev.js
├── server-setup.md
└── test
    └── deployapi.js

testing i got

~$ create-mithril-app test1
/usr/bin/env: ‘node\r’: No such file or directory

I fixed index.js following the issue #58 in darkguy2008/parallelshell
then i test again and...

~$ create-mithril-app test1
{ Error: ENOENT: no such file or directory, lstat '~/.config/yarn/global/node_modules/.bin/sampleApp'
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: '~/.config/yarn/global/node_modules/.bin/sampleApp' }
Unable to copy sampleApp into newly created directory.

I tried doing a symbolic link but it doesn't work.

~/.config/yarn/global/node_modules/.bin$ ln -s ../create-mithril-app/sampleApp sampleApp
~$ create-mithril-app test1
{ Error: EEXIST: file already exists, symlink '../create-mithril-app/sampleApp' -> '~/test1'
  errno: -17,
  code: 'EEXIST',
  syscall: 'symlink',
  path: '../create-mithril-app/sampleApp',
  dest: '~/test1' }
Unable to copy sampleApp into newly created directory.

I have replaced absolute path with "~/" to be brief.

@highmountaintea
Copy link
Owner

Thanks for reporting. I can recreate the issue, and will look into into.

@highmountaintea
Copy link
Owner

I have pushed a fix for this issue in version 1.0.21. Tested under OS X using npm. It uses require.resolve to find the module path, so should work for yarn as well. Let me know if it still causes a problem.

@boazblake
Copy link

I am having this issue with create-mithril-app@1.0.25

@giancarlocp
Copy link
Author

giancarlocp commented Mar 20, 2019

On linux using yarn.
/usr/bin/env: ‘node\r’: No such file or directory
I am fixing/removing the /r carriage return character following this:
https://stackoverflow.com/questions/21621722/removing-carriage-return-on-mac-os-x-using-sed

$ yarn global add create-mithril-app
$ yarn global list
yarn global v1.13.0
info "create-mithril-app@1.0.27" has binaries:
   - create-mithril-app
   - create-mithril-server
$ create-mithril-app m1
/usr/bin/env: ‘node\r’: No such file or directory
$ sed -i 's/\r//g' ~/.npm_modules/bin/create-mithril-*
$ create-mithril-app m1
module.js:549
    throw err;
    ^
Error: Cannot find module 'fs-extra'

I tried to install the fs-extra package

$ yarn global add fs-extra
warning "fs-extra@7.0.1" has no binaries

It is a yarn problem.
Then using npm it was installed.

$ npm -g i fs-extra
└─┬ fs-extra@7.0.1 
  ├── graceful-fs@4.1.15 
  ├── jsonfile@4.0.0 
  └── universalify@0.1.2 

But the problem persist.
So, i have removed all and tried again.

$ npm -g remove fs-extra
$ yarn global remove create-mithril-app
$ npm -g install create-mithril-app
└─┬ create-mithril-app@1.0.27 
  ├─┬ fs-extra@6.0.1 
  │ ├── graceful-fs@4.1.15 
  │ ├── jsonfile@4.0.0 
  │ └── universalify@0.1.2 
  └─┬ fsbin@1.0.7 
    └── fs-extra@5.0.0 
$ create-mithril-app m1
/usr/bin/env: ‘node\r’: No such file or directory
$ sed -i 's/\r//g' ~/.npm_modules/bin/create-mithril-*
$ create-mithril-app m1
module.js:549
    throw err;
    ^
Error: Cannot find module 'fs-extra'

struggling with node...

$ node -v
v8.10.0
$ npm -v
3.5.2

@highmountaintea
Copy link
Owner

I will have a look at both issues.

@highmountaintea
Copy link
Owner

I have not had a chance to replicate the issue yet, however, I find this link, not sure if it's relevant

yarnpkg/yarn#648

@highmountaintea
Copy link
Owner

@boazblake I also apologize for not seeing your comment before.

@highmountaintea
Copy link
Owner

@giancarlocp The reason you are seeing
/usr/bin/env: ‘node\r’: No such file or directory
is that yarn does not know how to handle \r\n line ending.

I have fixed the line ending issue and published a new version create-mithril-app@1.0.28. It works on my Ubuntu now. You can give it a try (side note: you probably want to remove fs-extra from global first, because you don't need it)

yarn global remove fs-extra
yarn global add create-mithril-app@latest

We should probably file an issue with yarn regarding the line ending.

@highmountaintea
Copy link
Owner

FYI I also filed a bug report with yarn to see if they'll change the behavior.

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

No branches or pull requests

3 participants