gpt4 book ai didi

node.js - npm 安装权限被拒绝 (macOS)

转载 作者:搜寻专家 更新时间:2023-10-31 22:37:39 27 4
gpt4 key购买 nike

要安装 Bootstrap 主题,我想运行 npm install。但是我总是收到权限被拒绝的错误。

我已经尝试过 nvm,然后切换到 nvm use 10.9.0 来运行 npm install

我还尝试了 sudo chown -R $(whoami) ~/.npmsudo chown -R $USER/usr/local/lib/node_modules。都没有解决它,现在我不知道如何继续。我使用 macOS High Sierra。

Marcs-MBP-3:masterclass Marc$ npm install
npm WARN deprecated gulp-uglifyjs@0.6.2: Since gulp-sourcemaps now works, use gulp-uglify instead
npm WARN deprecated babel-preset-es2015@6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN checkPermissions Missing write access to /Users/Marc/Desktop/Dev/masterclass/node_modules
npm ERR! path /Users/Marc/Desktop/Dev/masterclass/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/Marc/Desktop/Dev/masterclass/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/Users/Marc/Desktop/Dev/masterclass/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/Users/Marc/Desktop/Dev/masterclass/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/Marc/Desktop/Dev/masterclass/node_modules' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Marc/.npm/_logs/2018-08-22T12_46_51_786Z-debug.log

最佳答案

对于苹果机;

在终端上运行它>

sudo chown -R $USER /usr/local/lib/node_modules

关于node.js - npm 安装权限被拒绝 (macOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51967335/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com