【问题标题】:Node.js error now occurs after upgrading Ubuntu升级 Ubuntu 后会出现 Node.js 错误
【发布时间】:2019-06-01 06:11:17
【问题描述】:

我正在使用 VirtualBox 和 Vagrant 在 Windows 10 上构建 Ubuntu 的虚拟环境。

昨天从Ubuntu 14.04更新到Ubuntu 16.04.6 LTS后,运行node.js时出错。

当我尝试按以下方式启动 Web 应用程序时出现错误:

$ PORT=8000 npm start

/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:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    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:152:3)
    at Module._compile (internal/modules/cjs/loader.js:774:30)

Ubuntu版本升级之前没有出现这个错误。

我该如何解决这个错误?


我尝试了以下方法,但效果不佳。

$ rm -rf node_modules
$ npm install --reset-cache
/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:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    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:152:3)
    at Module._compile (internal/modules/cjs/loader.js:774:30)

【问题讨论】:

    标签: node.js vagrant virtualbox ubuntu-14.04 ubuntu-16.04


    【解决方案1】:

    尝试删除 node_modules 并运行 npm install --reset-cache 希望有所帮助

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-07
    • 2019-03-07
    • 2020-01-19
    • 2019-05-21
    • 2021-01-18
    相关资源
    最近更新 更多