gpt4 book ai didi

javascript - 在我的 Macbook 上安装 CoffeeScript 时遇到问题

转载 作者:行者123 更新时间:2023-11-29 22:13:15 25 4
gpt4 key购买 nike

我尝试通过以下命令安装 coffee-script:

npm -g install coffee-script

然后我得到了这些错误,

npm http GET https://registry.npmjs.org/coffee-script
npm http 200 https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.2.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.6.2.tgz
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/coffee-script',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/coffee-script',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 12.3.0
npm ERR! command "node" "/usr/local/bin/npm" "-g" "install" "coffee-script"
npm ERR! cwd /Users/cinker
npm ERR! node -v v0.10.9
npm ERR! npm -v 1.2.24
npm ERR! path /usr/local/lib/node_modules/coffee-script
npm ERR! fstream_path /usr/local/lib/node_modules/coffee-script
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/cinker/npm-debug.log
npm ERR! not ok code 0

然后我想用sudo模式用npm覆盖之前的安装,然而终端控制台又警告了,换句话说。

npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
/usr/local/bin/coffee -> /usr/local/lib/node_modules/coffee-script/bin/coffee
/usr/local/bin/cake -> /usr/local/lib/node_modules/coffee-script/bin/cake
npm WARN package.json github-url-from-git@1.1.1 No repository field.
npm WARN package.json assert-plus@0.1.2 No repository field.
npm WARN package.json ctype@0.5.2 No repository field.

当我执行 coffee-script 时,它起作用了。但是,当我运行 cake 时出现错误。

所以我的问题是:1. 我在安装时所做的有什么问题吗?2. 我可以删除 CoffeeScript 并重新安装吗?3.有没有其他方法可以做到这一点?(我试过自制软件,但失败了)?

非常感谢!

最佳答案

  • 作为suggested by Isaac ,您也可以这样做,然后将 coffee 安装为全局模块:

sudo chown -R $USER/usr/local

  • 是的,您可以删除 coffee-script 安装而不会造成任何伤害。
  • npm 是安装coffee 的好方法,尝试重新安装。

关于javascript - 在我的 Macbook 上安装 CoffeeScript 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16878600/

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