最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

typescript - Can't globally install ts-node in mac - Stack Overflow

programmeradmin3浏览0评论

When I typed npm i -g ts-node. I've tried using this "sudo chown -R $USER /usr/local/lib/node_modules" in the terminal and it asks for password but I am unable to type anything and if I press enter 3 times it just says "Sorry, try again" and "sudo: 3 incorrect password attempts." I've also tried other solutions and it also asks for a password which I can't type anything or that pressing enter. I do not know what to do anymore so if anyone could help solve this issue, I would greatly appreciate it!

Idk if this can help but when I run this code echo $path

/Library/Frameworks/Python.framework/Versions/3.12/bin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin /Library/Frameworks/Python.framework/Versions/3.12/bin /Users/jaja/Library/Application Support/Code/User/globalStorage/github.copilot-chat/debugCommand

npm error code EACCES
npm error syscall mkdir
npm error path /usr/local/lib/node_modules/ts-node
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/ts-node'
npm error     at async mkdir (node:internal/fs/promises:857:10)
npm error     at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:624:20
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 Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150: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: 'mkdir',
npm error   path: '/usr/local/lib/node_modules/ts-node'
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 error A complete log of this run can be found in: /Users/jaja/.npm/_logs/2025-02-19T07_03_26_034Z-debug-0.log

1st one I tried sudo chown -R $USER /usr/local/lib/node_modules

2nd: Run on macOS Terminal:

sudo chown -R $USER /usr/local/bin then provide your password

sudo npm install -g yarn to verify whether yarn has installed or not [enter image description here][1] sudo npm install -g yarn

There's also more but none worked. For some odd reason I can't install anything that's global.

发布评论

评论列表(0)

  1. 暂无评论