question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

egg-socket.io start error “Cannot convert undefined or null to object”

See original GitHub issue
  • Node Version:
  • Egg Version:
  • Plugin Name:
  • Plugin Version:
  • Platform:
  • Mini Showcase Repository:

我按照egg-socket.io项目中README的步骤,用npm并配置了这个插件,但是在npm run dev的时候一直报如下错误:

/root/projects/agent-server/node_modules/_egg@1.3.0@egg/lib/application.js:38
      throw e;
      ^

TypeError: Cannot convert undefined or null to object
    at Namespace.use (/root/projects/agent-server/node_modules/_socket.io@2.0.2@socket.io/lib/namespace.js:103:21)
    at initNsp (/root/projects/agent-server/node_modules/_egg-socket.io@2.0.0@egg-socket.io/lib/io.js:80:9)
    at module.exports.app (/root/projects/agent-server/node_modules/_egg-socket.io@2.0.0@egg-socket.io/lib/io.js:55:5)
    at AppWorkerLoader.loadFile (/root/projects/agent-server/node_modules/_egg-core@3.7.0@egg-core/lib/loader/egg_loader.js:270:34)
    at getLoadUnits.forEach.unit (/root/projects/agent-server/node_modules/_egg-core@3.7.0@egg-core/lib/loader/mixin/custom.js:25:29)
    at Array.forEach (native)
    at AppWorkerLoader.loadCustomApp (/root/projects/agent-server/node_modules/_egg-core@3.7.0@egg-core/lib/loader/mixin/custom.js:25:8)
    at AppWorkerLoader.load (/root/projects/agent-server/node_modules/_egg@1.3.0@egg/lib/loader/app_worker_loader.js:33:10)
    at new Application (/root/projects/agent-server/node_modules/_egg@1.3.0@egg/lib/application.js:34:19)
    at Object.<anonymous> (/root/projects/agent-server/node_modules/_egg-cluster@1.6.2@egg-cluster/lib/app_worker.js:12:13)

这是什么原因呢? node版本是6.10.2 npm版本3.10.10 egg-socket.io是直接用npm安装的(也用cnpm安装过,一样的错误)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:23 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
ngotcommented, Jun 13, 2017

我在搞了,马上发

2reactions
ChungTakcommented, Jun 5, 2017

已经找到问题了~~ egg-socket.io 2.0.0的原因,退回 egg-socket.io 1.2.2就好了,和egg版本 无关

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found