Macos 安装vue-cli老是遇到Error EACCES permission denied, access ‘ usr local lib node_modules‘怎么办

总结
  • 对于框架原理只能说个大概,真的深入某一部分具体的代码和实现方式就只能写出一个框架,许多细节注意不到。

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

  • 算法方面还是很薄弱,好在面试官都很和蔼可亲,擅长发现人的美哈哈哈…(最好多刷一刷,不然影响你的工资和成功率???)

  • 在投递简历之前,最好通过各种渠道找到公司内部的人,先提前了解业务,也可以帮助后期优秀 offer 的决策。

  • 要勇于说不,对于某些 offer 待遇不满意、业务不喜欢,应该相信自己,不要因为当下没有更好的 offer 而投降,一份工作短则一年长则 N 年,为了幸福生活要慎重选择!!!

第一次跳槽十分忐忑不安,和没毕业的时候开始找工作是一样的感受,真的要相信自己,有条不紊的进行。如果有我能帮忙的地方欢迎随时找我,比如简历修改、内推、最起码,可以把烦心事说一说,人嘛都会有苦恼的~

祝大家都有美好的未来,拿下满意的 offer。

if [ -z “ B A S H V E R S I O N " ] ∣ ∣ [ − n " {BASH_VERSION}" ] || [ -n " BASHVERSION"]∣∣[n"{ZSH_VERSION}” ]; then

shellcheck disable=SC2016

nvm_echo >&2 ‘Error: the install instructions explicitly say to pipe the install script to bash; please follow them’
exit 1
fi

nvm_grep() {
GREP_OPTIONS=‘’ command grep “$@”
}

nvm_default_install_dir() {
[ -z “KaTeX parse error: Expected 'EOF', got '&' at position 23: …NFIG_HOME-}" ] &̲& printf %s "{HOME}/.nvm” || printf %s “${XDG_CONFIG_HOME}/nvm”
}

nvm_install_dir() {
if [ -n “ N V M D I R " ] ; t h e n p r i n t f NVM_DIR" ]; then printf %s " NVMDIR"];thenprintf{NVM_DIR}”
else
nvm_default_install_dir
fi
}

nvm_latest_version() {
nvm_echo “v0.39.7”
}

nvm_profile_is_bash_or_zsh() {
local TEST_PROFILE
TEST_PROFILE=“ 1 − " c a s e " {1-}" case " 1"case"{TEST_PROFILE-}” in
*“/.bashrc” | *“/.bash_profile” | *“/.zshrc” | *“/.zprofile”)
return
;;
*)
return 1
;;
esac
}

Outputs the location to NVM depending on:

* The availability of $NVM_SOURCE

* The presence of $NVM_INSTALL_GITHUB_REPO

* The method used (“script” or “git” in the script, defaults to “git”)

NVM_SOURCE always takes precedence unless the method is “script-nvm-exec”

nvm_source() {
local NVM_GITHUB_REPO
NVM_GITHUB_REPO=“ N V M I N S T A L L G I T H U B R E P O : − n v m − s h / n v m " i f [ " {NVM_INSTALL_GITHUB_REPO:-nvm-sh/nvm}" if [ " NVMINSTALLGITHUBREPO:nvmsh/nvm"if["{NVM_GITHUB_REPO}” != ‘nvm-sh/nvm’ ]; then
{ nvm_echo >&2 “$(cat)” ; } << EOF
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE REPO IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!

The default repository for this install is `nvm-sh/nvm`,
but the environment variables `$NVM_INSTALL_GITHUB_REPO` is
currently set to `${NVM_GITHUB_REPO}`.

If this is not intentional, interrupt this installation and
verify your environment variables.
EOF
fi
local NVM_VERSION
NVM_VERSION=“KaTeX parse error: Expected '}', got 'EOF' at end of input: …STALL_VERSION:-(nvm_latest_version)}”
local NVM_METHOD
NVM_METHOD=“ 1 " l o c a l N V M S O U R C E U R L N V M S O U R C E U R L = " 1" local NVM_SOURCE_URL NVM_SOURCE_URL=" 1"localNVMSOURCEURLNVMSOURCEURL="NVM_SOURCE”
if [ “_ N V M M E T H O D " = " s c r i p t − n v m − e x e c " ] ; t h e n N V M S O U R C E U R L = " h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / NVM_METHOD" = "_script-nvm-exec" ]; then NVM_SOURCE_URL="https://raw.githubusercontent.com/ NVMMETHOD"="scriptnvmexec"];thenNVMSOURCEURL="https://raw.githubusercontent.com/{NVM_GITHUB_REPO}/KaTeX parse error: Expected group after '_' at position 35: …xec" elif [ "_̲NVM_METHOD” = “_script-nvm-bash-completion” ]; then
NVM_SOURCE_URL=“https://raw.githubusercontent.com/ N V M G I T H U B R E P O / {NVM_GITHUB_REPO}/ NVMGITHUBREPO/{NVM_VERSION}/bash_completion”
elif [ -z “KaTeX parse error: Expected group after '_' at position 35: …then if [ "_̲NVM_METHOD” = “script" ]; then
NVM_SOURCE_URL=“https://raw.githubusercontent.com/ N V M G I T H U B R E P O / {NVM_GITHUB_REPO}/ NVMGITHUBREPO/{NVM_VERSION}/nvm.sh”
elif [ "
N V M M E T H O D " = " g i t " ] ∣ ∣ [ − z " NVM_METHOD" = "_git" ] || [ -z " NVMMETHOD"="git"]∣∣[z"NVM_METHOD” ]; then
NVM_SOURCE_URL=“https://github.com/KaTeX parse error: Expected 'EOF', got '&' at position 49: … nvm_echo >&̲2 "Unexpected v…NVM_METHOD” for $NVM_METHOD"
return 1
fi
fi
nvm_echo “$NVM_SOURCE_URL”
}

Node.js version to install

nvm_node_version() {
nvm_echo “$NODE_VERSION”
}

nvm_download() {
if nvm_has “curl”; then
curl --fail --compressed -q "KaTeX parse error: Expected 'EOF', got '#' at position 36: …get"; then #̲ Emulate curl w…(nvm_echo “$@” | command sed -e ‘s/–progress-bar /–progress=bar /’
-e ‘s/–compressed //’
-e ‘s/–fail //’
-e ‘s/-L //’
-e ‘s/-I /–server-response /’
-e ‘s/-s /-q /’
-e ‘s/-sS /-nv /’
-e ‘s/-o /-O /’
-e ‘s/-C - /-c /’)
# shellcheck disable=SC2086
eval wget $ARGS
fi
}

install_nvm_from_git() {
local INSTALL_DIR
INSTALL_DIR=“ ( n v m i n s t a l l d i r ) " l o c a l N V M V E R S I O N N V M V E R S I O N = " (nvm_install_dir)" local NVM_VERSION NVM_VERSION=" (nvminstalldir)"localNVMVERSIONNVMVERSION="{NVM_INSTALL_VERSION:-KaTeX parse error: Expected 'EOF', got '}' at position 21: …latest_version)}̲" if [ -n "{NVM_INSTALL_VERSION:-}” ]; then
# Check if version is an existing ref
if command git ls-remote “ ( n v m s o u r c e " g i t " ) " " (nvm_source "git")" " (nvmsource"git")""NVM_VERSION” | nvm_grep -q “KaTeX parse error: Expected 'EOF', got '#' at position 33: …en : #̲ Check if versi…(nvm_source “script-nvm-exec”)”; then
nvm_echo >&2 “Failed to find ‘$NVM_VERSION’ version.”
exit 1
fi
fi

local fetch_error
if [ -d “$INSTALL_DIR/.git” ]; then
# Updating repo
nvm_echo “=> nvm is already installed in $INSTALL_DIR, trying to update using git”
command printf ‘\r=> ’
fetch_error=“Failed to update nvm with $NVM_VERSION, run ‘git fetch’ in $INSTALL_DIR yourself.”
else
fetch_error="Failed to fetch origin with N V M V E R S I O N . P l e a s e r e p o r t t h i s ! " n v m e c h o " = > D o w n l o a d i n g n v m f r o m g i t t o ′ NVM_VERSION. Please report this!" nvm_echo "=> Downloading nvm from git to ' NVMVERSION.Pleasereportthis!"nvmecho"=>DownloadingnvmfromgittoINSTALL_DIR’"
command printf '\r=> ’
mkdir -p “ I N S T A L L D I R " i f [ " {INSTALL_DIR}" if [ " INSTALLDIR"if["(ls -A “KaTeX parse error: Expected 'EOF', got '#' at position 32: … ]; then #̲ Initializing r…{INSTALL_DIR}” || {
nvm_echo >&2 ‘Failed to initialize nvm repo. Please report this!’
exit 2
}
command git --git-dir=” I N S T A L L D I R / . g i t " r e m o t e a d d o r i g i n " {INSTALL_DIR}/.git" remote add origin " INSTALLDIR/.git"remoteaddorigin"(nvm_source)" 2> /dev/null
|| command git --git-dir=“ I N S T A L L D I R / . g i t " r e m o t e s e t − u r l o r i g i n " {INSTALL_DIR}/.git" remote set-url origin " INSTALLDIR/.git"remoteseturlorigin"(nvm_source)” || {
nvm_echo >&2 ‘Failed to add remote “origin” (or set the URL). Please report this!’
exit 2
}
else
# Cloning repo
command git clone “ ( n v m s o u r c e ) " − − d e p t h = 1 " (nvm_source)" --depth=1 " (nvmsource)"depth=1"{INSTALL_DIR}” || {
nvm_echo >&2 ‘Failed to clone nvm repo. Please report this!’
exit 2
}
fi
fi

Try to fetch tag

if command git --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” fetch origin tag “$NVM_VERSION” --depth=1 2>/dev/null; then
:

Fetch given version

elif ! command git --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” fetch origin “KaTeX parse error: Expected 'EOF', got '&' at position 44: … nvm_echo >&̲2 "fetch_error”
exit 1
fi
command git -c advice.detachedHead=false --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” checkout -f --quiet FETCH_HEAD || {
nvm_echo >&2 “Failed to checkout the given version KaTeX parse error: Expected 'EOF', got '}' at position 48: …" exit 2 }̲ if [ -n "(command git --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” show-ref refs/heads/master)” ]; then
if command git --no-pager --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” branch --quiet 2>/dev/null; then
command git --no-pager --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” branch --quiet -D master >/dev/null 2>&1
else
nvm_echo >&2 “Your version of git is out of date. Please update it!”
command git --no-pager --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” branch -D master >/dev/null 2>&1
fi
fi

nvm_echo “=> Compressing and cleaning up git repository”
if ! command git --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” reflog expire --expire=now --all; then
nvm_echo >&2 “Your version of git is out of date. Please update it!”
fi
if ! command git --git-dir=“ I N S T A L L D I R " / . g i t − − w o r k − t r e e = " INSTALL_DIR"/.git --work-tree=" INSTALLDIR"/.gitworktree="INSTALL_DIR” gc --auto --aggressive --prune=now ; then
nvm_echo >&2 “Your version of git is out of date. Please update it!”
fi
return
}

Automatically install Node.js

nvm_install_node() {
local NODE_VERSION_LOCAL
NODE_VERSION_LOCAL=“$(nvm_node_version)”

if [ -z “$NODE_VERSION_LOCAL” ]; then
return 0
fi

nvm_echo “=> Installing Node.js version N O D E V E R S I O N L O C A L " n v m i n s t a l l " NODE_VERSION_LOCAL" nvm install " NODEVERSIONLOCAL"nvminstall"NODE_VERSION_LOCAL”
local CURRENT_NVM_NODE

CURRENT_NVM_NODE=" ( n v m v e r s i o n c u r r e n t ) " i f [ " (nvm_version current)" if [ " (nvmversioncurrent)"if["(nvm_version “ N O D E V E R S I O N L O C A L " ) " = = " NODE_VERSION_LOCAL")" == " NODEVERSIONLOCAL")"=="CURRENT_NVM_NODE” ]; then
nvm_echo “=> Node.js version $NODE_VERSION_LOCAL has been successfully installed”
else
nvm_echo >&2 “Failed to install Node.js $NODE_VERSION_LOCAL”
fi
}

install_nvm_as_script() {
local INSTALL_DIR
INSTALL_DIR=“ ( n v m i n s t a l l d i r ) " l o c a l N V M S O U R C E L O C A L N V M S O U R C E L O C A L = " (nvm_install_dir)" local NVM_SOURCE_LOCAL NVM_SOURCE_LOCAL=" (nvminstalldir)"localNVMSOURCELOCALNVMSOURCELOCAL="(nvm_source script)”
local NVM_EXEC_SOURCE
NVM_EXEC_SOURCE=“ ( n v m s o u r c e s c r i p t − n v m − e x e c ) " l o c a l N V M B A S H C O M P L E T I O N S O U R C E N V M B A S H C O M P L E T I O N S O U R C E = " (nvm_source script-nvm-exec)" local NVM_BASH_COMPLETION_SOURCE NVM_BASH_COMPLETION_SOURCE=" (nvmsourcescriptnvmexec)"localNVMBASHCOMPLETIONSOURCENVMBASHCOMPLETIONSOURCE="(nvm_source script-nvm-bash-completion)”

Downloading to $INSTALL_DIR

mkdir -p “ I N S T A L L D I R " i f [ − f " INSTALL_DIR" if [ -f " INSTALLDIR"if[f"INSTALL_DIR/nvm.sh” ]; then
nvm_echo “=> nvm is already installed in I N S T A L L D I R , t r y i n g t o u p d a t e t h e s c r i p t " e l s e n v m e c h o " = > D o w n l o a d i n g n v m a s s c r i p t t o ′ INSTALL_DIR, trying to update the script" else nvm_echo "=> Downloading nvm as script to ' INSTALLDIR,tryingtoupdatethescript"elsenvmecho"=>DownloadingnvmasscripttoINSTALL_DIR’”
fi
nvm_download -s “ N V M S O U R C E L O C A L " − o " NVM_SOURCE_LOCAL" -o " NVMSOURCELOCAL"o"INSTALL_DIR/nvm.sh” || {
nvm_echo >&2 “Failed to download 'KaTeX parse error: Expected 'EOF', got '}' at position 35: … return 1 }̲ & nvm_downlo…NVM_EXEC_SOURCE” -o “KaTeX parse error: Expected '}', got '&' at position 42: … nvm_echo >&̲2 "Failed to do…NVM_EXEC_SOURCE’”
return 2
} &
nvm_download -s “ N V M B A S H C O M P L E T I O N S O U R C E " − o " NVM_BASH_COMPLETION_SOURCE" -o " NVMBASHCOMPLETIONSOURCE"o"INSTALL_DIR/bash_completion” || {
nvm_echo >&2 “Failed to download ‘$NVM_BASH_COMPLETION_SOURCE’”
return 2
} &
for job in ( j o b s − p ∣ c o m m a n d s o r t ) d o w a i t " (jobs -p | command sort) do wait " (jobspcommandsort)dowait"job" || return ? d o n e c h m o d a + x " ? done chmod a+x " ?donechmoda+x"INSTALL_DIR/nvm-exec" || {
nvm_echo >&2 “Failed to mark ‘$INSTALL_DIR/nvm-exec’ as executable”
return 3
}
}

nvm_try_profile() {
if [ -z “ 1 − " ] ∣ ∣ [ ! − f " {1-}" ] || [ ! -f " 1"]∣∣[!f"{1}” ]; then
return 1
fi
nvm_echo “${1}”
}

Detect profile file if not specified as environment variable

(eg: PROFILE=~/.myprofile)

The echo’ed path is guaranteed to be an existing file

Otherwise, an empty string is returned

nvm_detect_profile() {
if [ “${PROFILE-}” = ‘/dev/null’ ]; then
# the user has specifically requested NOT to have nvm touch their profile
return
fi

if [ -n “KaTeX parse error: Expected 'EOF', got '&' at position 14: {PROFILE}" ] &̲& [ -f "{PROFILE}” ]; then
nvm_echo “${PROFILE}”
return
fi

local DETECTED_PROFILE
DETECTED_PROFILE=‘’

if [ “KaTeX parse error: Expected '}', got '#' at position 7: {SHELL#̲*bash}" != "SHELL” ]; then
if [ -f “ H O M E / . b a s h r c " ] ; t h e n D E T E C T E D P R O F I L E = " HOME/.bashrc" ]; then DETECTED_PROFILE=" HOME/.bashrc"];thenDETECTEDPROFILE="HOME/.bashrc”
elif [ -f “ H O M E / . b a s h p r o f i l e " ] ; t h e n D E T E C T E D P R O F I L E = " HOME/.bash_profile" ]; then DETECTED_PROFILE=" HOME/.bashprofile"];thenDETECTEDPROFILE="HOME/.bash_profile”
fi
elif [ “KaTeX parse error: Expected '}', got '#' at position 7: {SHELL#̲*zsh}" != "SHELL” ]; then
if [ -f “ H O M E / . z s h r c " ] ; t h e n D E T E C T E D P R O F I L E = " HOME/.zshrc" ]; then DETECTED_PROFILE=" HOME/.zshrc"];thenDETECTEDPROFILE="HOME/.zshrc”
elif [ -f “ H O M E / . z p r o f i l e " ] ; t h e n D E T E C T E D P R O F I L E = " HOME/.zprofile" ]; then DETECTED_PROFILE=" HOME/.zprofile"];thenDETECTEDPROFILE="HOME/.zprofile”
fi
fi

if [ -z “ D E T E C T E D P R O F I L E " ] ; t h e n f o r E A C H P R O F I L E i n " . p r o f i l e " " . b a s h r c " " . b a s h p r o f i l e " " . z p r o f i l e " " . z s h r c " d o i f D E T E C T E D P R O F I L E = " DETECTED_PROFILE" ]; then for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zprofile" ".zshrc" do if DETECTED_PROFILE=" DETECTEDPROFILE"];thenforEACHPROFILEin".profile"".bashrc"".bashprofile"".zprofile"".zshrc"doifDETECTEDPROFILE="(nvm_try_profile “ H O M E / {HOME}/ HOME/{EACH_PROFILE}”)”; then
break
fi
done
fi

if [ -n “ D E T E C T E D P R O F I L E " ] ; t h e n n v m e c h o " DETECTED_PROFILE" ]; then nvm_echo " DETECTEDPROFILE"];thennvmecho"DETECTED_PROFILE”
fi
}

Check whether the user has any globally-installed npm modules in their system

Node, and warn them if so.

nvm_check_global_modules() {
local NPM_COMMAND
NPM_COMMAND=“ ( c o m m a n d − v n p m 2 > / d e v / n u l l ) " ∣ ∣ r e t u r n 0 [ − n " (command -v npm 2>/dev/null)" || return 0 [ -n " (commandvnpm2>/dev/null)"∣∣return0[n"{NVM_DIR}” ] && [ -z “KaTeX parse error: Expected '}', got 'EOF' at end of input: {NPM_COMMAND%%"NVM_DIR”/*}" ] && return 0

local NPM_VERSION
NPM_VERSION=“ ( n p m − − v e r s i o n ) " N P M V E R S I O N = " (npm --version)" NPM_VERSION=" (npmversion)"NPMVERSION="{NPM_VERSION:–1}”
[ “${NPM_VERSION%%[!-0-9]*}” -gt 0 ] || return 0

local NPM_GLOBAL_MODULES
NPM_GLOBAL_MODULES=“ ( n p m l i s t − g − − d e p t h = 0 ∣ c o m m a n d s e d − e ′ / n p m @ / d ′ − e ′ / ( e m p t y ) ( npm list -g --depth=0 | command sed -e '/ npm@/d' -e '/ (empty) (npmlistgdepth=0∣commandsede/npm@/de/(empty)/d’
)”

local MODULE_COUNT
MODULE_COUNT=“ ( c o m m a n d p r i n t f ( command printf %s\\n " (commandprintfNPM_GLOBAL_MODULES” |
command sed -ne ‘1!p’ | # Remove the first line
wc -l | command tr -d ’ ’ # Count entries
)"

if [ "KaTeX parse error: Expected 'EOF', got '#' at position 36: …0' ]; then #̲ shellcheck dis…PATH`)’
# shellcheck disable=SC2016

最后

整理面试题,不是让大家去只刷面试题,而是熟悉目前实际面试中常见的考察方式和知识点,做到心中有数,也可以用来自查及完善知识体系。

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

《前端基础面试题》,《前端校招面试题精编解析大全》,《前端面试题宝典》,《前端面试题:常用算法》

前端面试题宝典

前端校招面试题详解

最后

整理面试题,不是让大家去只刷面试题,而是熟悉目前实际面试中常见的考察方式和知识点,做到心中有数,也可以用来自查及完善知识体系。

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

《前端基础面试题》,《前端校招面试题精编解析大全》,《前端面试题宝典》,《前端面试题:常用算法》

[外链图片转存中…(img-GrIli2xD-1715789577257)]

[外链图片转存中…(img-veONYdTR-1715789577258)]

[外链图片转存中…(img-VyoAUTXh-1715789577258)]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值