Ts-node: TypeError: Path must be a string

Created on 7 Jul 2017  路  4Comments  路  Source: TypeStrong/ts-node

Hi, My build is failing in windows (appveyor) when I run:

nyc -r=text -i ts-node/register -e .ts mocha -t 5000 --require ts-node/register  --require reflect-metadata/Reflect "**/*.spec.ts"

The error is:

path.js:8
    throw new TypeError('Path must be a string. Received ' +
    ^
TypeError: Path must be a string. Received [ '.nycrc', '.nycrc.json' ]
    at assertPath (path.js:8:11)
    at Object.win32.resolve (path.js:130:5)
    at join (C:\projects\inversify-express-example\node_modules\nyc\node_modules\find-up\index.js:11:14)
    at Function.module.exports.sync (C:\projects\inversify-express-example\node_modules\nyc\node_modules\find-up\index.js:43:12)
    at Object.Config.loadConfig (C:\projects\inversify-express-example\node_modules\nyc\lib\config-util.js:17:23)
    at Object.<anonymous> (C:\projects\inversify-express-example\node_modules\nyc\bin\nyc.js:23:25)
    at Module._compile (module.js:397:26)
    at Object.Module._extensions..js (module.js:404:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
npm ERR! Test failed.  See above for more details.
npm ERR! code ELIFECYCLE

You can see a PR @ https://github.com/inversify/inversify-express-example/pull/212

I'm not sure about the root cause of the error.

The source code of the branch used in the PR @ https://github.com/inversify/inversify-express-example/tree/update-dependencies

Thanks!

invalid

Most helpful comment

No problem 馃槃 Sorry if I came off aggressive, I haven't found a perfect way to respond to things like this and a lot of them when I do, don't actually ever receive another response anyway. They're just drive-by issues where there's some expectation I'll fix things. So thanks a ton for responding, it helps me remember that there's good people who just need help! 馃憤

All 4 comments

I'm not sure why you opened it here, but this seems like nyc. Nothing in your stack trace nor the error itself points to ts-node. I'll take a quick look just in case, but spending my time debugging others issues isn't really something I enjoy doing and is a large part of the reason I'm stepping back from open source. It's a damned if I do and damned if I don't situation.

So based on the error you have, it seems like you aren't having the latest find-up installed with nyc. It's using the version before it supported arrays, hence the error you see. Here's the specific line: https://github.com/sindresorhus/find-up/blob/dc2912e2a823138ed8efcadc61c11e10ffcf0534/index.js#L11. As for why this is being used instead of the proper dependency specified by nyc, I can't tell - I don't think NPM@5 outputs the nice graph of installed dependencies anymore so I can't which versions are which (although find-up is clearly wrong). If you get list the dependencies, that might be a good first step.

Spending my time debugging others issues isn't really something I enjoy doing and is a large part of the reason I'm stepping back from open source.

Sorry, about this. Don't mean to frustrate you. I really appreciate the work you do.

Last night I said:

I'm not sure about the root cause of the error.

My mistake I don't know why I though it was ts-node I feel stupid now :cry: I don't expect you to spend an hour debugging my code... Just pointing me into nyc is a huge help. So thanks for that!

No problem 馃槃 Sorry if I came off aggressive, I haven't found a perfect way to respond to things like this and a lot of them when I do, don't actually ever receive another response anyway. They're just drive-by issues where there's some expectation I'll fix things. So thanks a ton for responding, it helps me remember that there's good people who just need help! 馃憤

Was this page helpful?
0 / 5 - 0 ratings