Skip to content

Error using tern with threejs library #1026

Open

Description

@kjuen

Trying to use tern with the threejs library, https://threejs.org, resulted in the following error:

Request failed: Could not start Tern server
def.js:439
throw new Error("Invalid !type spec: " + tp);
^

Error: Invalid !type spec: number
at passOne (def.js:439:17)
at doLoadEnvironment (def.js:515:74)
at Object.exports.load (def.js:535:7)
at infer.js:869:13
at Object.exports.withContext (infer.js:883:18)
at new exports.Context (infer.js:851:13)
at exports.Server.reset (tern.js:153:17)
at new exports.Server (tern.js:130:10)
at startServer (bootstrap.js:139:16)
at bootstrapServer (bootstrap.js:162:10)

(Note that I removed absolute paths from the error message and traceback)
The tern version is 0.24.1.. I created the threejs.json file with the following command:
./condense --name threejs /opt/js/three.js/build/three.min.js > ../defs/threejs.json

With a bit of trial and error I got tern to work by removing some lines of the threejs.json file. But it seems that something is wrong either with generating or parsing the json definition file.

These are the lines I removed from threejs.json to make the whole thing work:

  • "THREE.PropertyMixer.prototype.accumulate.!0": {
  •  "!type": "number",
    
  •  "!span": "494860[838:378]-494861[838:379]"
    
  • },
  • "THREE.PropertyMixer.prototype._select.!1": {
  •  "!type": "number",
    
  •  "!span": "495506[840:4]-495507[840:5]"
    
  • },
  • "THREE.PropertyMixer.prototype._lerp.!1": {
  •  "!type": "number",
    
  •  "!span": "495647[840:145]-495648[840:146]"
    
  • },

and

  • "THREE.PropertyMixer._mixBufferRegion.!1": {
  •  "!type": "number",
    
  •  "!span": "495647[840:145]-495648[840:146]"
    
  • },
  • "THREE.AnimationMixer._actions.": {
  •  "_byClipCacheIndex": {
    
  •    "!type": "number",
    
  •    "!span": "511077[869:472]-511094[869:489]"
    
  •  },
    
  •  "_cacheIndex": {
    
  •    "!type": "number",
    
  •    "!span": "511166[870:57]-511177[870:68]"
    
  •  }
    
  • },

Tern is great. Thanks for providing it!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions