mac安装nvm“ pm WARN unmet dependency /usr/local/lib/node_modules/ionic requires”

本文提供了一步式指南,详细说明了如何在Mac操作系统上安装Node Version Manager (nvm),包括安装步骤和环境变量配置,解决在使用nvm命令时可能出现的错误。

可以前往https://github.com/creationix/nvm#installation查看更具体步骤,这里只做备忘,mac下如何安装

打开终端,执行

sudo curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash


执行

. ~/.nvm/nvm.sh

添加环境变量,便能直接使用nvm命令,不然会出现-bash: nvm: command not found的情况


如果出现


不知道是不是因为我之前装过npm的原因,我卸载npm(sudo npm uninstall npm -g)后就可以了

[gitlab-runner@c ~]$ npm install gitbook-cli -g npm WARN deprecated q@1.5.0: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other. npm WARN deprecated npm WARN deprecated (For a CapTP with native promises, see @endo/eventual-send and @endo/captp) [..................] - fetchMetadata: WARN deprecated q@1.5.0: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScri [..................] | fetchMetadata: WARN deprecated q@1.5.0: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScri [..................] \ fetchMetadata: WARN deprecated q@1.5.0: You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScri npm WARN checkPermissions Missing write access to /usr/local/node/lib/node_modules/gitbook-cli/node_modules/npmi/node_modules/npm/node_modules/ansistyles npm WARN checkPermissions Missing write access to /usr/local/node/lib/node_modules/gitbook-cli/node_modules/npmi/node_modules/npm/node_modules/path-is-inside npm WARN checkPermissions Missing write access to /usr/local/node/lib/node_modules/gitbook-cli npm WARN checkPermissions Missing write access to /usr/local/node/lib/node_modules/gitbook-cli/node_modules/npmi/node_modules/npm/node_modules npm WARN checkPermissions Missing write access to /usr/local/node/lib/node_modules npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/node/lib/node_modules/gitbook-cli/node_modules/npmi/node_modules/npm/node_modules/ansistyles npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/node/lib/node_modules/gitbook-cli/node_modules/npmi/node_modules/npm/node_modules/ansistyles' npm ERR! [Error: EACCES: permission denied, access '/usr/local/node/lib/node_modules/gitbook-cli/node_modules/npmi/node_modules/npm/node_modules/ansistyles'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/node/lib/node_modules/gitbook-cli/node_modules/npmi/node_modules/npm/node_modules/ansistyles' 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/gitlab-runner/.npm/_logs/2025-08-14T09_56_46_078Z-debug.log
最新发布
08-15
❯ npm update -g npm error code EACCES npm error syscall rename npm error path /usr/local/lib/node_modules/npm npm error dest /usr/local/lib/node_modules/.npm-i9nnxROI npm error errno -13 npm error Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI' npm error at async Object.rename (node:internal/fs/promises:783:10) npm error at async moveFile (/usr/local/lib/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js:30:5) npm error at async Promise.allSettled (index 0) npm error at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11) npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5) npm error at async Update.exec (/usr/local/lib/node_modules/npm/lib/commands/update.js:63:5) npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:207:9) npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:74:5) { npm error errno: -13, npm error code: 'EACCES', npm error syscall: 'rename', npm error path: '/usr/local/lib/node_modules/npm', npm error dest: '/usr/local/lib/node_modules/.npm-i9nnxROI' npm error } npm error npm error The operation was rejected by your operating system. npm error It is likely you do not have the permissions to access this file as the current user npm error npm error If you believe this might be a permissions issue, please double-check the npm error permissions of the file and its containing directories, or try running npm error the command again as root/Administrator. npm notice npm notice New major version of npm available! 10.9.2 -> 11.4.2 npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.4.2 npm notice To update run: npm install -g npm@11.4.2 npm notice npm error A complete log of this run can be found in: /Users/shensunfeng/.npm/_logs/2025-07-20T19_03_44_934Z-debug-0.log
07-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值