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

Plugin zsh-history-enquierer not found (npm permission denied) #27

Closed
AA1999 opened this issue Dec 9, 2022 · 13 comments
Closed

Plugin zsh-history-enquierer not found (npm permission denied) #27

AA1999 opened this issue Dec 9, 2022 · 13 comments
Labels
help wanted Extra attention is needed not a bug

Comments

@AA1999
Copy link

AA1999 commented Dec 9, 2022

Hi, I run the script as instructed
And upon launching the terminal I see this before the shell:

[oh-my-zsh] plugin 'zsh-history-enquirer' not found

I have tried installing that individually as well, but to no avail
Using both the npm command and the curl one

@AA1999 AA1999 changed the title Plugins autojump and zsh-history-enquierer not found Plugin zsh-history-enquierer not found Dec 9, 2022
@zthxxx
Copy link
Owner

zthxxx commented Dec 10, 2022

hi, what's your environment? System and version of zsh / npm

@AA1999
Copy link
Author

AA1999 commented Dec 11, 2022

neofetch output:
image

@AA1999
Copy link
Author

AA1999 commented Dec 11, 2022

npm version: 8.19.2

@zthxxx
Copy link
Owner

zthxxx commented Dec 12, 2022

@AA1999 sorry for slow reply. I need you do some steps for troubleshooting,

  1. please run this command and show me the output
ls -alh ~/.oh-my-zsh/custom/plugins/zsh-history-enquirer
  1. run npm install command again and show me the output
npm i -g zsh-history-enquirer
ls -alh ~/.oh-my-zsh/custom/plugins/zsh-history-enquirer
cat ~/.zshrc

@AA1999
Copy link
Author

AA1999 commented Dec 16, 2022

╭─[arshia-pc] as arshia in ~                                 12:29:53
╰──➤ ls -alh ~/.oh-my-zsh/custom/plugins/zsh-history-enquirer
ls: cannot access '/home/arshia/.oh-my-zsh/custom/plugins/zsh-history-enquirer': No such file or directory                           exit:2
╭─[arshia-pc] as arshia in ~                                 12:30:40
╰──➤ npm i -g zsh-history-enquirer
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/zsh-history-enquirer
npm ERR! dest /usr/lib/node_modules/.zsh-history-enquirer-GGPM0rKh
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/zsh-history-enquirer' -> '/usr/lib/node_modules/.zsh-history-enquirer-GGPM0rKh'
npm ERR!  [Error: EACCES: permission denied, rename '/usr/lib/node_modules/zsh-history-enquirer' -> '/usr/lib/node_modules/.zsh-history-enquirer-GGPM0rKh'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/usr/lib/node_modules/zsh-history-enquirer',
npm ERR!   dest: '/usr/lib/node_modules/.zsh-history-enquirer-GGPM0rKh'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/arshia/.npm/_logs/2022-12-16T09_00_48_288Z-debug-0.log                         ~4s  exit:243

When running that with sudo:

╭─[arshia-pc] as arshia in ~                                                                           12:31:19
╰──➤ sudo npm i -g zsh-history-enquirer
[sudo] password for arshia:

changed 1 package, and audited 2 packages in 2s

found 0 vulnerabilities 

╭─[arshia-pc] as arshia in ~                                                                           12:32:14
╰──➤ ls -alh ~/.oh-my-zsh/custom/plugins/zsh-history-enquirer
ls: cannot access '/home/arshia/.oh-my-zsh/custom/plugins/zsh-history-enquirer': No such file or directo exit:2

Contents of .zshrc:

╭─[arshia-pc] as arshia in ~                                                                           12:32:47
╰──➤ cat ~/.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="jovial"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
zstyle ':omz:update' mode auto      # update automatically without asking
# zstyle ':omz:update' mode reminder  # just remind me to update when it's time

# Uncomment the following line to change how often to auto-update (in days).
zstyle ':omz:update' frequency 13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
HIST_STAMPS="yyyy-mm-dd"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
  autojump
  urltools
  bgnotify
  zsh-autosuggestions
  zsh-syntax-highlighting
  zsh-history-enquirer
  jovial
  postgres
)

[[ -s /home/arshia/.autojump/etc/profile.d/autojump.sh ]] && source /home/arshia/.autojump/etc/profile.d/autojump.sh

autoload -U compinit && compinit -u

fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias yeet="paru -Rns"
alias refsync="sudo reflector --latest 200 --age 6 --protocol http,https --sort rate --save /etc/pacman.d/mirrorlist"
alias vrsync="rsync --progress -r"
alias shell="ps -p $$ -oargs="

export PATH="${PATH}:/home/arshia/.local/bin:/home/arshia/.local/lib:/usr/local/psql/bin:/home/arshia/Desktop/clion-2022.1/bin:/usr/local/bin"

export CC=clang
export CXX=clang++
export CFLAGS='-O3 -pipe -std=c17'
export CXXFLAGS='-O3 -pipe -std=c++20'
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)

@zthxxx zthxxx added help wanted Extra attention is needed not a bug labels Dec 19, 2022
@zthxxx
Copy link
Owner

zthxxx commented Dec 19, 2022

@AA1999 according to the log message, the issue that just "not have the permissions to access /usr/lib/node_modules",

please try

ls -ld /usr/lib/node_modules
sudo chown -R $USER /usr/lib/node_modules
npm i -g zsh-history-enquirer

Note that not need to do sudo npm install ..., because it's install for root, not for you (arshia)

@AA1999
Copy link
Author

AA1999 commented Jan 30, 2023

Sorry for the late response, here's the output:

╭─[arshia-pc] as arshia in ~                                                                           15:52:36
╰──➤ ls -ld /usr/lib/node_modules
drwxr-xr-x 1 root root 230 Dec 16 12:31 /usr/lib/node_modules

╭─[arshia-pc] as arshia in ~                                                                           15:52:58
╰──➤ sudo chown -R $USER /usr/lib/node_modules
[sudo] password for arshia:                                                                                 ~5s

╭─[arshia-pc] as arshia in ~                                                                           15:53:27
╰──➤ npm i -g zsh-history-enquirer
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/bin/zsh-history-enquirer
npm ERR! dest /usr/bin/.zsh-history-enquirer-bglL5R0C
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/bin/zsh-history-enquirer' -> '/usr/bin/.zsh-history-enquirer-bglL5R0C'
npm ERR!  [Error: EACCES: permission denied, rename '/usr/bin/zsh-history-enquirer' -> '/usr/bin/.zsh-history-enquirer-bglL5R0C'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rename',
npm ERR!   path: '/usr/bin/zsh-history-enquirer',
npm ERR!   dest: '/usr/bin/.zsh-history-enquirer-bglL5R0C'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/arshia/.npm/_logs/2023-01-30T12_23_32_245Z-debug-0.log                         ~5s  exit:243

╭─[arshia-pc] as arshia in ~                                                                           15:53:36

@zthxxx
Copy link
Owner

zthxxx commented Jan 31, 2023

according to the log message, the problem is permissions of path /usr/bin/

maybe you also need sudo chown -R $USER /

@AA1999
Copy link
Author

AA1999 commented Feb 4, 2023

but won't that kinda mess up everything?
/usr/bin should belong to root

@zthxxx
Copy link
Owner

zthxxx commented Feb 5, 2023

yes, but it's seems a bug of npm,

in mac, it should be /usr/local/bin/ rather than /usr/bin/

https://stackoverflow.com/questions/56286121/where-does-npm-install-g-package-install-the-package

@AA1999
Copy link
Author

AA1999 commented Feb 5, 2023

Maybe the plugin itself has that issue cause running npm i -g on any other package always seemed to work for me.
Tho I'm not entirely sure

@zthxxx
Copy link
Owner

zthxxx commented Feb 6, 2023

I think not, the installation process is entirely npm behaviour,

maybe try troubleshooting follow https://stackoverflow.com/questions/47252451/permission-denied-when-installing-npm-modules-in-osx , that fits your question very well

@AA1999
Copy link
Author

AA1999 commented Feb 11, 2023

Yup it seems to work now, tyvm!

@AA1999 AA1999 closed this as completed Feb 11, 2023
@zthxxx zthxxx changed the title Plugin zsh-history-enquierer not found Plugin zsh-history-enquierer not found (npm permission denied) Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed not a bug
Projects
None yet
Development

No branches or pull requests

2 participants