Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"undefined is not a function" #47

Closed
katanacrimson opened this issue Dec 11, 2017 · 8 comments
Closed

"undefined is not a function" #47

katanacrimson opened this issue Dec 11, 2017 · 8 comments
Assignees

Comments

@katanacrimson
Copy link

katanacrimson commented Dec 11, 2017

As on tin - running into this error suddenly when trying to "Update Imports". Probably some code I wrote, however...running tsc, the typescript compiles fine.

Exec error: TypeError: undefined is not a function
    at esm.module.then.items (C:\Users\katana\AppData\Roaming\Sublime Text 3\Packages\ImportHelper\backend_run.js:47:24)
    at <anonymous>
error: Import Helper
TypeError: undefined is not a function
    at esm.module.then.items (C:\Users\katana\AppData\Roaming\Sublime Text 3\Packages\ImportHelper\backend_run.js:47:24)
    at <anonymous>

Considering there's no context outside of the package itself, not sure what's going wrong here. LMK if you need any additional info.

@katanacrimson
Copy link
Author

...Looking at the file referenced, it looks like it's the Array.push()...which doesn't make a whole lot of sense. Possibly the result array is getting nulled out somehow?

@unlight
Copy link
Owner

unlight commented Dec 11, 2017

It is very weird.
It should not depend on code that you have written.
Please, check you version of node. v6.0.0+ is required.

@katanacrimson
Copy link
Author

katanacrimson commented Dec 11, 2017

nvm installed version of node, using 8.9.0 currently.

@katanacrimson
Copy link
Author

katanacrimson commented Dec 12, 2017

Just noticed that currently, if I run Update Imports, it gives me that error twice (the exact code block above). Not sure what to make of that, but it may be significant.

@unlight
Copy link
Owner

unlight commented Dec 12, 2017

https://github.com/unlight/sublime-import-helper/blob/master/backend/commands/get_modules.js#L25
This line throws error.
I cant imagine how I can get result as non array here.
I can add stupid check there like Array.isArray(result) but I would like to catch this bug.

Yes, it is running twice. First run for dependecies, second for devDependencies

@katanacrimson
Copy link
Author

katanacrimson commented Dec 12, 2017

In that case - here's dependencies and devDependencies (since you mentioned it - maybe it's relevant?):

  "dependencies": {
    "@types/node": "^8.0.54",
    "base62.js": "^0.5.0",
    "bcrypt": "^1.0.3",
    "config": "^1.28.1",
    "debug": "^3.1.0",
    "fs-extra": "^4.0.2",
    "koa": "^2.4.1",
    "koa-body": "^2.5.0",
    "koa-favicon": "^2.0.0",
    "koa-helmet": "^3.3.0",
    "koa-router": "^7.3.0",
    "koa-session-minimal": "^3.0.4",
    "koa-static": "^4.0.2",
    "mysql": "^2.15.0",
    "mysql2": "^1.5.1",
    "reflect-metadata": "^0.1.10",
    "sequelize": "^4.26.0",
    "sharp": "^0.18.4",
    "swagger2": "^0.0.26",
    "swagger2-koa": "^0.0.38"
  },
  "devDependencies": {
    "@types/chai": "^4.0.7",
    "@types/config": "^0.0.33",
    "@types/debug": "^0.0.30",
    "@types/fs-extra": "^4.0.5",
    "@types/koa": "^2.0.42",
    "@types/koa-router": "^7.0.27",
    "@types/mocha": "^2.2.44",
    "chai": "^4.1.2",
    "mocha": "^4.0.1",
    "sequelize-typescript": "^0.6.1",
    "ts-node": "^3.3.0",
    "tslint": "^5.8.0",
    "tslint-config-standard": "^7.0.0",
    "typescript": "^2.5.3"
  }

@unlight
Copy link
Owner

unlight commented Dec 12, 2017

Thanks, it is reproducable now. I will investigate it.

@unlight
Copy link
Owner

unlight commented Dec 13, 2017

Fixed in v1.7.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants