I am unable to tsd install
with tsd.json file getting error unexpected token t
[ERR!] cwd : /Users/laszlo.gyulai/repos/workspaces-webapp
[ERR!] os : Darwin 14.5.0
[ERR!] argv : "/usr/local/bin/node" "/Users/laszlo.gyulai/npm-global/bin/tsd" "install"
[ERR!] node : v4.2.2
[ERR!] tsd : 0.6.5
[ERR!] Error: Unexpected token t
[ERR!] CODE : undefined
[ERR!] Unexpected token t
[ERR!] If you need help, you may report this error at:
https://github.com/DefinitelyTyped/tsd/issues
[ERR!]
SyntaxError: Unexpected token t
at Object.parse (native)
at parseJson (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/build/xm/fileIO.js:30:21)
at Object.readJSONSync (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/build/xm/fileIO.js:41:12)
at Context.stackSettings (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/build/tsd/context/Context.js:34:44)
at new Context (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/build/tsd/context/Context.js:19:14)
at getContext (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/build/tsd/CLI.js:65:23)
at /Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/build/tsd/CLI.js:85:20
at tryCatch1 (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/node_modules/bluebird/js/main/util.js:63:19)
at Promise$_callHandler [as _callHandler] (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/node_modules/bluebird/js/main/promise.js:695:13)
at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/node_modules/bluebird/js/main/promise.js:711:18)
[ERR!] tsd.json: {"version":"v4","repo":"borisyankov/DefinitelyTyped","ref":"master","path":"typings","bundle":"typings/tsd.d.ts","installed":{"jquery/jquery.d.ts":{"commit":"09e37435ffb2c56a6f908081194a74756f24f99d"},"rivets/rivets.d.ts":{"commit":"cc25c17418e5b7937135c00bb959af38b494dd02"},"moment/moment.d.ts":{"commit":"b3aeee64552e324581fdbe0926f4a96e981e451b"},"moment/moment-node.d.ts":{"commit":"b3aeee64552e324581fdbe0926f4a96e981e451b"},"jqueryui/jqueryui.d.ts":{"commit":"76ed26e95e91f1c91f2d11819c44b55b617e859a"},"lodash/lodash.d.ts":{"commit":"af76bf46025371c760d8fe8c03cf874428da6124"},"mocha/mocha.d.ts":{"commit":"af76bf46025371c760d8fe8c03cf874428da6124"},"chai/chai.d.ts":{"commit":"af76bf46025371c760d8fe8c03cf874428da6124"},"jquery.transit/jquery.transit.d.ts":{"commit":"09e37435ffb2c56a6f908081194a74756f24f99d"},"es6-promise/es6-promise.d.ts":{"commit":"68548c2daab053869f323d475419c693478bbb73"},"localForage/localForage.d.ts":{"commit":"68548c2daab053869f323d475419c693478bbb73"}}}
[ERR!] .tsdrc could not be retrieved
[ERR!] Please include the following file with any support request:
/Users/laszlo.gyulai/repos/workspaces-webapp/tsd-debug.log
Trying to console.log() the text
variable in file fileIO.js:30:21
gives this invalid JSON:
{
"_args": [
[
"tsd",
""
]
],
"_from": "tsd@*",
"_id": "[email protected]",
"_inCache": true,
"_installable": true,
"_location": "/tsd",
"_nodeVersion": "0.12.7",
"_npmUser": {
"email": "[email protected]",
"name": "diullei"
},
"_npmVersion": "2.11.3",
"_phantomChildren": {},
"_requested": {
"name": "tsd",
"raw": "tsd",
"rawSpec": "",
"scope": null,
"spec": "*",
"type": "range"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/tsd/-/tsd-0.6.5.tgz",
"_shasum": "34a0b64c1db6a70b3860fe4f5571d9d1357421ad",
"_shrinkwrap": null,
"_spec": "tsd",
"_where": "",
"author": {
"name": "Bart van der Schoor",
"url": "https://github.com/Bartvds"
},
"bin": {
"tsd": "./build/cli.js"
},
"bugs": {
"url": "https://github.com/DefinitelyTyped/tsd/issues"
},
"contributors": [
{
"name": "Diullei Gomes",
"url": "https://github.com/Diullei"
}
],
"dependencies": {
"assertion-error": "1.0.0",
"bl": "^0.9.3",
"bluebird": "~1.2.4",
"chalk": "^1.0.0",
"colors": "^1.1.0",
"deep-freeze": "0.0.1",
"definition-header": "~0.1.0",
"detect-indent": "^0.2.0",
"diff": "^1.4.0",
"event-stream": "~3.1.5",
"exit": "~0.1.2",
"glob": "^4.0.6",
"joi": "^4.7.0",
"joi-assert": "0.0.3",
"jsesc": "^0.5.0",
"json-pointer": "^0.2.2",
"lazy.js": "~0.3.2",
"lru-cache": "~2.5.0",
"minimatch": "^1.0.0",
"minimist": "^1.1.0",
"ministyle": "~0.1.3",
"minitable": "0.0.4",
"miniwrite": "~0.1.3",
"mkdirp": "~0.5.0",
"open": "~0.0.5",
"request": "^2.45.0",
"rimraf": "~2.2.8",
"semver": "^4.3.1",
"type-detect": "~0.1.2",
"universal-analytics": "~0.3.4",
"update-notifier": "^0.2.2",
"uri-templates": "~0.1.5",
"uuid": "^2.0.1",
"verror": "~1.4.0"
},
"description": "TypeScript Definition manager for DefinitelyTyped",
"devDependencies": {
"chai": "~1.9.1",
"chai-as-promised": "~4.1.1",
"chai-fs": "^0.1.0",
"chai-fuzzy": "~1.4.0",
"chai-shallow-deep-equal": "0.0.3",
"dir-compare": "^0.0.2",
"grunt": "~0.4.4",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-connect": "~0.8.0",
"grunt-contrib-copy": "^0.6.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-mocha-test": "^0.12.1",
"grunt-regex-replace": "~0.2.5",
"grunt-shell": "^1.1.1",
"grunt-todos": "~0.3.0",
"grunt-ts": "4.1.0",
"grunt-ts-clean": "~0.2.0",
"grunt-tslint": "git+https://github.com/Bartvds/grunt-tslint.git#feature/multi",
"grunt-tv4": "~0.4.0",
"gruntfile-gtx": "^0.3.0",
"jshint-path-reporter": "~0.1",
"mocha": "^1.21.4",
"mocha-unfunk-reporter": "^0.4.0",
"ncp": "^1.0.1",
"package.json-schema": "~0.2.0",
"source-map-support": "~0.2.6",
"time-grunt": "^1.0.0",
"tslint-path-formatter": "~0.1.1",
"typescript": "1.5.3"
},
"directories": {},
"dist": {
"shasum": "34a0b64c1db6a70b3860fe4f5571d9d1357421ad",
"tarball": "http://registry.npmjs.org/tsd/-/tsd-0.6.5.tgz"
},
"engines": {
"node": ">= 0.10.0"
},
"gitHead": "b6f7933b12a6f435deadcb042e14ab5ef8b9b638",
"homepage": "https://github.com/DefinitelyTyped/tsd",
"keywords": [
"definition",
"manager",
"package",
"typescript"
],
"licenses": [
{
"type": "Apache 2.0",
"url": "https://raw.github.com/DefinitelyTyped/tsd/master/LICENSE.txt"
}
],
"main": "./build/api.js",
"maintainers": [
{
"name": "diullei",
"email": "[email protected]"
},
{
"name": "bartvds",
"email": "[email protected]"
},
{
"name": "basarat",
"email": "[email protected]"
},
{
"name": "blakeembrey",
"email": "[email protected]"
}
],
"name": "tsd",
"optionalDependencies": {},
"preferGlobal": true,
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/tsd.git"
},
"scripts": {
"prepublish": "grunt pre_publish",
"test": "grunt test"
},
"version": "0.6.5"
}
{
"proxy" : null,
"token" : null,
"git": {
"raw": {
"concurrent": 10,
"allowClean": true,
"splitDirLevel": 1,
"splitDirChunk": 2,
"cacheCleanInterval": {
"days": 1
},
"localMaxAge": {
"days": 7
},
"httpInterval": {
"days": 1
},
"httpIntervalRef": {
"minutes": 1
},
"jobTimeout": {
"seconds": 5
}
},
"api": {
"concurrent": 5,
"allowClean": true,
"splitDirLevel": 1,
"splitDirChunk": 2,
"cacheCleanInterval": {
"days": 1
},
"localMaxAge": {
"days": 7
},
"httpInterval": {
"minutes": 5
},
"jobTimeout": {
"seconds": 5
}
}
},
"tracker": {
"enabled": true,
"accountID" : "UA-47495295-1"
},
"update-notifier": {
"enabled": true,
"registryUrl": "http://registry.npmjs.org/%s",
"updateCheckTimeout": {
"seconds": 10
},
"updateCheckInterval": {
"days": 7
}
}
}
{
token: "9f3eaadb6ecaef344b358aa4e14315ce82ac9540"
}
Even running tsd
on its own results in same error. - Undexpected token t
TSD is trying to read the settings.json
file. Could you send me this file?
/Users/laszlo.gyulai/npm-global/lib/node_modules/tsd/conf/settings.json
@Diullei , here is the settings.json - thanks for looking at it:
{
"proxy" : null,
"token" : null,
"git": {
"raw": {
"concurrent": 10,
"allowClean": true,
"splitDirLevel": 1,
"splitDirChunk": 2,
"cacheCleanInterval": {
"days": 1
},
"localMaxAge": {
"days": 7
},
"httpInterval": {
"days": 1
},
"httpIntervalRef": {
"minutes": 1
},
"jobTimeout": {
"seconds": 5
}
},
"api": {
"concurrent": 5,
"allowClean": true,
"splitDirLevel": 1,
"splitDirChunk": 2,
"cacheCleanInterval": {
"days": 1
},
"localMaxAge": {
"days": 7
},
"httpInterval": {
"minutes": 5
},
"jobTimeout": {
"seconds": 5
}
}
},
"tracker": {
"enabled": true,
"accountID" : "UA-47495295-1"
},
"update-notifier": {
"enabled": true,
"registryUrl": "http://registry.npmjs.org/%s",
"updateCheckTimeout": {
"seconds": 10
},
"updateCheckInterval": {
"days": 7
}
}
}
Ok, could you attach this file here or send to me by email ([email protected]). I think this could be a problem with the file encode. Having the original file I'll be able to test it on my environment.
I had a similar issue. Had to set the encoding to UTF-8 without BOM (using Notepad++). Issue solved.
I am having same issue. I am not sure where to define the encoding?
@vijay-karajgikar Notepad++ -> Encoding menu.
Thank you, that was a head scratcher.
In VisualStudio: File -> Advanced Save Options -> Unicode (UTF-8 without signature) - Codepage 65001
This is no longer an issue. Closing.
Most helpful comment
I had a similar issue. Had to set the encoding to UTF-8 without BOM (using Notepad++). Issue solved.