Help us understand the problem. What is going on with this article?

TypeError: log.gauge.isEnabled is not a function

More than 1 year has passed since last update.

状況

  • nodeのバージョン管理にtj/nを使っている
  • この記事のような手順でnpmをグローバルインストールしたことがある

という状況でタイトルのエラーが出ました。ログはこんな感じです。

$ npm install
/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:57
log.progressEnabled = log.gauge.isEnabled()
                                ^

TypeError: log.gauge.isEnabled is not a function
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:57:33)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:22:13
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:148:3)

なお、 $ yarn install でも同じ状況になりました。

対処

/usr/local/lib/node_modules/npm/ 以下を rm -r コマンドで消去し、nでnodeのバージョンを変更したら直りました。

考察

おそらくこの記事みたいなハックをしたのが原因な気がしています。素直にnpmは放置して、yarnを使うのがよさそうな気がしました。

ぜひ同じようなエラーに当たった人は参考にしてみてください。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away