LoginSignup
5
4

More than 5 years have passed since last update.

TypeError: log.gauge.isEnabled is not a function

Posted at

状況

  • 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を使うのがよさそうな気がしました。

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

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4