マシン環境が変わったので、Node.jsに入っていたパッケージ類も再インストールが必要となりました。そして、(既存のコードもあるので)CoffeeScriptを入れようとしたのですが…
$ npm i coffeescript -g
npm WARN deprecated coffeescript@99.999.99999: You misspelled 'coffee-script'
> coffeescript@99.999.99999 preinstall /path/to/coffeescript
> node super-evil-script-omg-for-reals.js
You misspelled 'coffee-script'
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "/path/to/node" "/path/to/node_modules/npm/bin/npm-cli.js" "i" "coffeescript"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! coffeescript@99.999.99999 preinstall: `node super-evil-script-omg-for-reals.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the coffeescript@99.999.99999 preinstall script 'node super-evil-script-omg-for-reals.js'.
npm ERR! This is most likely a problem with the coffeescript package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node super-evil-script-omg-for-reals.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs coffeescript
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls coffeescript
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
ネタばらし
super-evil-script
なんて出て面食らったのですが、いちばん上にあるように、CoffeeScriptコンパイラの正しいパッケージ名はcoffee-script
です(npm)。誰かがcoffeescript
にこんなパッケージを入れていたようですが、エラーで止まってくれるので、これはまだジョークの範囲で済みます(Gist)。
実際に起きていた
そして、別件でnpmを覗いていたところ、crossenv
malware on the npm registryというような記事を発見しました。いわく、cross-env
(本物)に対するcrossenv
のような、「有名なパッケージと似た名前を使って、マルウェアをインストールさせる」という事態が実際に起きていた、とのことでした。ハイフン・アンダーバー・何もなしなど、単語区切りは間違いやすいので、本当に入念な注意が必要そうです。