Giter VIP home page Giter VIP logo

Comments (13)

AA1999 avatar AA1999 commented on June 19, 2024 1

Yup it seems to work now, tyvm!

from jovial.

zthxxx avatar zthxxx commented on June 19, 2024

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

from jovial.

AA1999 avatar AA1999 commented on June 19, 2024

neofetch output:
image

from jovial.

AA1999 avatar AA1999 commented on June 19, 2024

npm version: 8.19.2

from jovial.

zthxxx avatar zthxxx commented on June 19, 2024

@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

from jovial.

AA1999 avatar AA1999 commented on June 19, 2024
╭─[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)

from jovial.

zthxxx avatar zthxxx commented on June 19, 2024

@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)

from jovial.

AA1999 avatar AA1999 commented on June 19, 2024

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

from jovial.

zthxxx avatar zthxxx commented on June 19, 2024

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

maybe you also need sudo chown -R $USER /

from jovial.

AA1999 avatar AA1999 commented on June 19, 2024

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

from jovial.

zthxxx avatar zthxxx commented on June 19, 2024

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

from jovial.

AA1999 avatar AA1999 commented on June 19, 2024

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

from jovial.

zthxxx avatar zthxxx commented on June 19, 2024

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

from jovial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.