Last-Order / Minyami

A lovely video downloader for HLS videos
GNU General Public License v3.0
561 stars 37 forks source link

minyami --help doesn't work when I already installed Minyami on Mac #67

Closed shippudean closed 3 years ago

shippudean commented 3 years ago

Basic Information:

I've been encountering this stressful issue whenever I'm trying to run Minyami.

When I type minyami --help to test Minyami, I always face with -bash: minyami: command not found when it's already installed on my Mac. Therefore this resulted in me reinstalling it again and again on my terminal whenever I try to use Minyami.

How to solve this issue so I run Minyami smoothly without reinstalling it again?

Last-Order commented 3 years ago

Did you installed Minyami via npm? Which command did you use?

shippudean commented 3 years ago

Yes! The command that I used to install is

npm install -g minyami

Last-Order commented 3 years ago

Have you tried to add npm's global binary folder to the PATH? You can get the path by npm bin -g.

FYI: https://stackoverflow.com/questions/15054388/global-node-modules-not-installing-correctly-command-not-found

shippudean commented 3 years ago

I tried to type npm bin -g and it says

/Users/(myname)/.npm-global/bin (not in PATH env variable)

That does mean it is not on PATH, yet? I tried following the simple coding from https://stackoverflow.com/questions/46058546/error-eacces-permission-denied-access-usr-lib-node-modules and it worked when I typed minyami --help

BUT, once I opened a new tab on my terminal and typed minyami --help, the command is not working unless I re-type the coding from that stackoverflow thread 😅

Here are the codes:

  • On the command line, in your home directory, create a directory for global installations:

mkdir ~/.npm-global

  • Configure npm to use the new directory path:

npm config set prefix '~/.npm-global'

  • In your preferred text editor, open or create a ~/.profile file and add this line:

export PATH=~/.npm-global/bin:$PATH

  • On the command line, update your system variables:

source ~/.profile

Last-Order commented 3 years ago

You need to add export PATH=~/.npm-global/bin:$PATH to the configuration files of your shell. By default it's .bashrc and if you are using zsh please use .zshrc.

https://stackoverflow.com/questions/45596833/bashrc-save-for-export

shippudean commented 3 years ago

I've already typed export PATH=~/.npm-global/bin:$PATHbut whenever I tried to put on a new Bash session, the minyami --help still won't be running.

And how do I know if I'm using zsh? 🤔

Last-Order commented 3 years ago

I mean you should add export PATH=~/.npm-global/bin:$PATH to your .bashrc, not justing executing it.

You can execute echo $SHELL to know the current shell you are using.

shippudean commented 3 years ago

Typed echo $SHELLand it says /bin/bash. Does that mean I'm using .bashrc?

May I know how do I add export PATH=~/.npm-global/bin:$PATH to my .bashrc? I'm new to this coding so I'm just following an easier tutorial to understand 😅

Last-Order commented 3 years ago

Try this. echo 'export PATH="~/.npm-global/bin:$PATH"' >> ~/.bashrc

Then start a new terminal tab to test if it's working.

shippudean commented 3 years ago

Typed echo 'export PATH="PATH=~/.npm-global/bin:$PATH"' >> ~/.bashrc and when I typed minyami --help in a new terminal tab, it's not working and give me the same following:

-bash: minyami: command not found

Last-Order commented 3 years ago

Well.. That's strange.

Could you try the following steps and provide some information?

  1. npm i -g minyami
  2. whereis minyami The output should be /Users/(your_username)/.npm-global/bin/minyami

By the way, this is not a problem of Minyami. I think there were something wrong when you were installing Node. Have you tried re-installing Node?

shippudean commented 3 years ago

For npm i -g minyami the result says

changed 56 packages, and audited 57 packages in 6s

1 package is looking for funding run npm fund for details

found 0 vulnerabilities

But when I typed whereis minyami, it just gives me a blank:

192:~ myusername$ 😔

Yes! I have reinstalled Node from the official website (the latest version) and from Homebrew (which doesn't work and people suggested downloading from the official site instead).

Last-Order commented 3 years ago

Sorry I don't have any idea about your situation... Maybe you can start a thread on Stackoverflow with the information above. Since this is not a problem of Minyami, I will close this issue later.

shippudean commented 3 years ago

Thank you for your fast response and replies!

tuzi3040 commented 3 years ago

Cloud you please try find ~ -name minyami and paste the output?

shippudean commented 3 years ago

Typed find ~ -name minyami and It says

find: /Users/myusername/Library/Application Support/MobileSync: Operation not permitted
find: /Users/myusername/Library/Application Support/CallHistoryTransactions: Operation not permitted
find: /Users/myusername/Library/Application Support/com.apple.TCC: Operation not permitted
find: /Users/myusername/Library/Application Support/CallHistoryDB: Operation not permitted
find: /Users/myusername/Library/IdentityServices: Operation not permitted
find: /Users/myusername/Library/Messages: Operation not permitted
find: /Users/myusername/Library/HomeKit: Operation not permitted
find: /Users/myusername/Library/Mail: Operation not permitted
find: /Users/myusername/Library/Safari: Operation not permitted
find: /Users/myusername/Library/Suggestions: Operation not permitted
find: /Users/myusername/Library/Containers/com.apple.Safari: Operation not permitted
find: /Users/myusername/Library/PersonalizationPortrait: Operation not permitted
find: /Users/myusername/Library/Metadata/CoreSpotlight: Operation not permitted
find: /Users/myusername/Library/Cookies: Operation not permitted
find: /Users/myusername/Library/Caches/com.apple.safaridavclient: Operation not permitted
find: /Users/myusername/Library/Caches/com.apple.HomeKit.configurations: Operation not permitted
find: /Users/myusername/Library/Caches/CloudKit/com.apple.Safari: Operation not permitted
find: /Users/myusername/Library/Caches/com.apple.Safari: Operation not permitted
/Users/myusername/.Trash/node_modules/.bin/minyami
/Users/myusername/.Trash/node_modules/minyami
/Users/myusername/.npm-global/bin/minyami
/Users/myusername/.npm-global/lib/node_modules/minyami
tuzi3040 commented 3 years ago

ls -l ~/.npm-global/bin/ and echo $SHELL; echo $PATH please.

Last-Order commented 3 years ago

Sorry I have a typo in https://github.com/Last-Order/Minyami/issues/67#issuecomment-775207001 The correct command should be echo 'export PATH="~/.npm-global/bin:$PATH"' >> ~/.bashrc

shippudean commented 3 years ago

As for ls -l ~/.npm-global/bin/ here's the output:

total 0
lrwxr-xr-x  1 myusername  staff  47 Feb  8 21:21 awsmobile -> ../lib/node_modules/awsmobile-cli/bin/awsmobile
lrwxr-xr-x  1 myusername  staff  57 Feb  8 21:21 awsmobile-configure -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-configure
lrwxr-xr-x  1 myusername  staff  55 Feb  8 21:21 awsmobile-console -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-console
lrwxr-xr-x  1 myusername  staff  54 Feb  8 21:21 awsmobile-delete -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-delete
lrwxr-xr-x  1 myusername  staff  56 Feb  8 21:21 awsmobile-features -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-features
lrwxr-xr-x  1 myusername  staff  52 Feb  8 21:21 awsmobile-init -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-init
lrwxr-xr-x  1 myusername  staff  55 Feb  8 21:21 awsmobile-publish -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-publish
lrwxr-xr-x  1 myusername  staff  52 Feb  8 21:21 awsmobile-pull -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-pull
lrwxr-xr-x  1 myusername  staff  52 Feb  8 21:21 awsmobile-push -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-push
lrwxr-xr-x  1 myusername  staff  51 Feb  8 21:21 awsmobile-run -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-run
lrwxr-xr-x  1 myusername  staff  53 Feb  8 21:21 awsmobile-start -> ../lib/node_modules/awsmobile-cli/bin/awsmobile-start
lrwxr-xr-x  1 myusername  staff  37 Feb  8 21:33 jshint -> ../lib/node_modules/jshint/bin/jshint
lrwxr-xr-x  1 myusername  staff  41 Feb  8 22:12 minyami -> ../lib/node_modules/minyami/dist/index.js
lrwxr-xr-x  1 myusername  staff  38 Feb  8 21:25 tsc -> ../lib/node_modules/typescript/bin/tsc
lrwxr-xr-x  1 myusername  staff  43 Feb  8 21:25 tsserver -> ../lib/node_modules/typescript/bin/tsserver

And for the echo $SHELL; echo $PATH:

/bin/bash
/opt/local/bin:/opt/local/sbin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
shippudean commented 3 years ago

Sorry I have a typo in #67 (comment) The correct command should be echo 'export PATH="~/.npm-global/bin:$PATH"' >> ~/.bashrc

Still not working and giving me the:

-bash: minyami: command not found

when I open a new terminal tab 😔

tuzi3040 commented 3 years ago

Try ~/.npm-global/bin/minyami --version.

shippudean commented 3 years ago

Typed ~/.npm-global/bin/minyami --version and it says:

Minyami / A lovely video downloader / 4.0.0
うめãĢゃん~ (虎>Ī‰<)

but still not working when I typed minyami --help

tuzi3040 commented 3 years ago

Sorry I have a typo in #67 (comment)

The correct command should be echo 'export PATH="~/.npm-global/bin:$PATH"' >> ~/.bashrc

Still not working and giving me the:

-bash: minyami: command not found

when I open a new terminal tab 😔

cat ~/.bashrc please.

shippudean commented 3 years ago

For cat ~/.bashrc it says:

export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myusername/.npm-global/bin
export PATH="PATH=~/.npm-global/bin:$PATH"
export PATH="PATH=~/.npm-global/bin:$PATH"
export PATH="~/.npm-global/bin:$PATH"
export PATH="~/.npm-global/bin:$PATH"
tuzi3040 commented 3 years ago

Please type mv ~/.bashrc ~/.bashrc.bak && echo 'export ~/.npm-global/bin:$PATH' > ~/.bashrc and try minyami --version. This will backup your original bashrc file and create a new one, in case you may have some other code in it.

shippudean commented 3 years ago

After I typed mv ~/.bashrc ~/.bashrc.bak && echo 'export ~/.npm-global/bin:$PATH' > ~/.bashrc and tried minyami --version, it still says:

-bash: minyami: command not found ☚ī¸

tuzi3040 commented 3 years ago

Type source ~/.bashrc and try minyami again please.

tuzi3040 commented 3 years ago

Oh, my fault. Sorry. Please type mv ~/.bashrc ~/.bashrc.bak1 && echo 'export PATH=~/.npm-global/bin:$PATH' > ~/.bashrc.

shippudean commented 3 years ago

I first typed: mv ~/.bashrc ~/.bashrc.bak1 && echo 'export PATH=~/.npm-global/bin:$PATH' > ~/.bashrc

Then, source ~/.bashr and says:

-bash: /Users/myusername/.bashr: No such file or directory

And then, minyami --version:

-bash: minyami: command not found đŸ˜Ŗ

tuzi3040 commented 3 years ago

I first typed: `mv ~/.bashrc ~/.bashrc.bak1 && echo 'export PATH=~/.npm-global/bin:$PATH' > ~/.bashrc

`

Then, source ~/.bashr and says:

-bash: /Users/myusername/.bashr: No such file or directory

And then, minyami --version:

-bash: minyami: command not found đŸ˜Ŗ

It should be source ~/.bashrc, you missed a c.

shippudean commented 3 years ago

Oh! My bad! Just did the steps:

  1. mv ~/.bashrc ~/.bashrc.bak1 && echo 'export PATH=~/.npm-global/bin:$PATH' > ~/.bashrc
  2. source ~/.bashrc
  3. minyami --version

And the output is:

Minyami / A lovely video downloader / 4.0.0
うめãĢゃん~ (虎>Ī‰<)

But the issue is still the same when I typed minyami --version or minyami --help, both are not working in a new terminal tab. Like, I should re-type those following steps again to run minyami in a new terminal tab 😅

tuzi3040 commented 3 years ago

Okay. So now when bashrc is sourced, PATH is properly exported. The question is, ~/.bashrc is not automaticly sourced when you enter your bash session, which should be normally. How do you enter your bash session?

shippudean commented 3 years ago

I just click + to create a new tab on my terminal and I saw it loading to login. So I figured minyami won't start automatically in the new bash session unless I re-type those following steps.

tuzi3040 commented 3 years ago

Which terminal app do you use? And...

I saw it loading to login

? Why login? Are you running terminal on some kind of virtual environment instead of macos native terminal? If so, bashrc file may not be sourced automaticlly, like using WSL1 under Windows.

tuzi3040 commented 3 years ago

Try this. echo '[ -r ~/.bashrc ] && . ~/.bashrc' >> ~/.bash_profile

shippudean commented 3 years ago

Which terminal app do you use? And...

I saw it loading to login

? Why login? Are you running terminal on some kind of virtual environment instead of macos native terminal? If so, bashrc file may not be sourced automaticlly, like using WSL1 under Windows.

(Apologize for the delay, it was late at midnight in my GMT and now I'm awake)

No, I'm running on macOS native terminal. What I meant is like this: the login after I clicked + before it started to appear as ~ --bash tab video.

So I'm confused why it won't run automatically when I opened a new terminal tab đŸ˜ĸ

shippudean commented 3 years ago

Try this. echo '[ -r ~/.bashrc ] && . ~/.bashrc' >> ~/.bash_profile

I typed this and it works, but it doesn't when I opened a new tab like this: video

Here I provided you with a video for better understanding on my issues 😅

tuzi3040 commented 3 years ago

Sorry for the delay. Github didn't mail me so I thought you didn't reply.

In your first video, you ran minyami --help in Tab 2, then open the new Tab, Tab 3. In the second, xxxxx > ~/.bash_profile and minyami --version was typed in Tab 2, and minyami --version ran in Tab 3.

You see, Tab 3 is opened before you type 'bash_profile' bunch of stuff, so the bash session in Tab 3 is not affected by the modification made afterwards in Tab 2.

So you should open a new Tab, like Tab 4, after you type those in Tab 2, to observe the difference.

shippudean commented 3 years ago

Thank you! So the only thing for Minyami to run in a new terminal tab is by typing echo '[ -r ~/.bashrc ] && . ~/.bashrc' >> ~/.bash_profile then try to test with minyami --version?

tuzi3040 commented 3 years ago

No. In theory, you only have to run echo '[ -r ~/.bashrc ] && . ~/.bashrc' >> ~/.bash_profile once. And all the bash session opened after this should automatically add npm global bin path to $PATH. Then you can type minyami without pre path.

If not, there may be other things gone wrong, which I may not be good enough to help you with.

shippudean commented 3 years ago

OMG! I just tested in a new terminal by typing minyami without running echo '[ -r ~/.bashrc ] && . ~/.bashrc' >> ~/.bash_profile and it works like a charm 😭!!

Thank you so much for the patience in teaching me, tuzi3040!! Grateful for your help!!

tuzi3040 commented 3 years ago

It's okay. I'm glad that I can help you.