-
Notifications
You must be signed in to change notification settings - Fork 12.8k
update to npm v4.7.2, got error: False expression: Non-string value passed to ts.resolveTypeReferenceDirective
#49257
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
update to npm v4.7.2, got error: False expression: Non-string value passed to ts.resolveTypeReferenceDirective
#49257
Comments
As the error message says, not a TS bug. #47921 |
Let's depend on exact versions instead of compatible versions to keep builds reproducible. The practical reason is that the current `typescript` dependency installs latest 4.7.2, which fails the build: ncc: Using [email protected] (local user-provided) Error: Module build failed (from ./node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js): Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself. at Object.resolveTypeReferenceDirective (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:42530:18) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:316837 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303785 at Array.map (<anonymous>) at Object.resolveTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303777) at actualResolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116611:163) at resolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116911:26) at processTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118393:31) at findSourceFileWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118278:21) at findSourceFile (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118133:26) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1770552 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:374702 at _done (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:9:1) at eval (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:34:22) As it's still an open issue, we anyway need to avoid that specific version: microsoft/TypeScript#49257 But better to just have explicit version numbers to avoid stuff breaking when our source stays the same.
Let's depend on exact versions instead of compatible versions to keep builds reproducible. The practical reason is that the current `typescript` dependency installs latest 4.7.2, which fails the build: ncc: Using [email protected] (local user-provided) Error: Module build failed (from ./node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js): Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself. at Object.resolveTypeReferenceDirective (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:42530:18) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:316837 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303785 at Array.map (<anonymous>) at Object.resolveTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303777) at actualResolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116611:163) at resolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116911:26) at processTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118393:31) at findSourceFileWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118278:21) at findSourceFile (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118133:26) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1770552 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:374702 at _done (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:9:1) at eval (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:34:22) As it's still an open issue, we anyway need to avoid that specific version: microsoft/TypeScript#49257 But better to just have explicit version numbers to avoid stuff breaking when our source stays the same.
Let's depend on exact versions instead of compatible versions to keep builds reproducible. The practical reason is that the current `typescript` dependency installs latest 4.7.2, which fails the build: ncc: Using [email protected] (local user-provided) Error: Module build failed (from ./node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js): Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself. at Object.resolveTypeReferenceDirective (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:42530:18) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:316837 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303785 at Array.map (<anonymous>) at Object.resolveTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303777) at actualResolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116611:163) at resolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116911:26) at processTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118393:31) at findSourceFileWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118278:21) at findSourceFile (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118133:26) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1770552 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:374702 at _done (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:9:1) at eval (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:34:22) As it's still an open issue, we anyway need to avoid that specific version: microsoft/TypeScript#49257 But better to just have explicit version numbers to avoid stuff breaking when our source stays the same.
Let's depend on exact versions instead of compatible versions to keep builds reproducible. The practical reason is that the current `typescript` dependency installs latest 4.7.2, which fails the build: ncc: Using [email protected] (local user-provided) Error: Module build failed (from ./node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js): Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself. at Object.resolveTypeReferenceDirective (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:42530:18) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:316837 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303785 at Array.map (<anonymous>) at Object.resolveTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/loaders/ts-loader.js.cache.js:13:303777) at actualResolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116611:163) at resolveTypeReferenceDirectiveNamesWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:116911:26) at processTypeReferenceDirectives (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118393:31) at findSourceFileWorker (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118278:21) at findSourceFile (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/typescript/lib/typescript.js:118133:26) at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:1770552 at /Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:37:374702 at _done (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:9:1) at eval (eval at create (/Users/penberg/src/chiselstrike/chiselstrike/packages/create-chiselstrike-app/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:20:75523), <anonymous>:34:22) As it's still an open issue, we anyway need to avoid that specific version: microsoft/TypeScript#49257 But better to just have explicit version numbers to avoid stuff breaking when our source stays the same. (cherry picked from commit c2f4748)
Hi, sorry if this has already been answered, but should we revert our TS version or Ts-node version to a specific v4.X.X version in our projects in order for this error to go away? Or how do we make it go away? |
You can install the old versions in this site: https://www.npmjs.com/package/typescript. |
Have the same problem and Update: The root cause in my case is old version of |
Why all the downvotes on my comment? The issue is with ts-node, not TypeScript. That’s why the error message is worded the way it is, as it was a known breaking change. |
"npm install typescript@latest ts-node@latest" Didn't fix it for me. |
Please see (and don't thumb-down!) fatcerberus's comment above. The message explicitly states that the API consumer is out-of-date. |
Same having the error and switching versions didn't make it. Should we ask in other repo? |
I do not have ts-node in my project. So pinning a ts-node version is irrelevant? $ yarn why ts-node
yarn why v1.22.15
[1/4] Why do we have the module "ts-node"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
error We couldn't find a match!
Done in 0.66s. There was a breaking change in a feature release of TypeScript? The error message describes changing the signature of a method. When pinning the typescript version down from 4.7.2 to 4.6.4 fixes it without doing anything else, how can you say
Do you expect package authors to keep up if you completely disregard SemVer?
Anyone using Caret Ranges or other vague versioning is going to eat it for this. 100s of man hours right there.. |
This new assert made me loose like 4 hours trying to figure out the issue, just downgrading typescript to version 4.4.4 fixed it for me. It's a problem that the message doesn't explicitly says which dependency is causing the problem. I don't really understand why such an assert was added in the first place, if it's so common for dependencies to send an object instead of a string, why don't it simply accepts the object and processes it accordingly. If both of those random dependencies broke I can't imagine the amount of dependencies that will need to be fixed for this to work again, people will end up downgrading typescript version instead. |
@fatcerberus I think people were annoyed you seem to be repeating what the error says but not giving a solution. Also this doesn't just happen with ts-node, I don't even have that as dependency in my project, and it was working fine until I updated the typescript version |
Yes, because it’s not something that the TypeScript team can fix. The problem is that something in your toolchain is calling an API with the wrong parameter, and the solution will depend on exactly which tool that is. We literally can’t provide any more information than the error message already does.
How do you propose TS is supposed to know that? It just knows that someone called a function with a bad value. |
@fatcerberus I was just answering your question. But on a side note, there is actually solution/workaround, downgrading typescript to a version before 4.7. About your second question, if you look at the function that throws the issue you will see the parameters are right there, just printing them in the exception would be enough, at least to get a clue of what is happening: containingFile is the most important one, since it tells you the file |
btw the assert was added to catch the error early (and mention that it’s not a TS issue) because originally it was failing later on with a completely inscrutable error message. |
First of all Open Your package.json file. |
@mendsalbert why are you so sure that everyone expecting this problem has |
I just upgraded to latest typescript at |
How do you determine which package throws this ts.resolveTypeReferenceDirective error? Nothing in my terminal tells me what dependency is causing this error. I've been waiting for a fix for this for 2 months. I cannot use any TS version except 4.7.* due to some dependency requirements so downgrading isn't an option for me. |
I should note changing the line mentioned from @JavierPAYTEF / stacktrace to this, will tell you what's wrong. He's right about that.
You just need to know |
I ended up going with the downgrade route because I had too many dependencies that had dependencies that flagged this exception. This exception should only be in 5+, according to semver rules. Breaking on a minor release isn't good for anyone. At the very least the exception should give the source of |
I had to downgrade typescript from |
This was fixed for me when I manually installed ts-loader version 9.3.1 instead of whatever webpack etc was installing itself |
this issue started happening for me when I installed |
Having everything updates, typescript, ts-loader, ts-node to the latest version. ts-node-dev is not in my package list, not even after installing all sub-packages. Issue still persists. What to do now? |
Tip: In my case, it was a vue2 project with webpack. There, I accidently removed the property "types" from the tsconfig. Re-Adding webpack-env to {
"compilerOptions": {
// ...
"types": [
"webpack-env"
],
// ...
} |
@Hobart2967 A lot of people made it seem like this is a ts-node issue, it's not. This is basically a breaking change for a lot of dependencies, and I don't see them updating any time soon, specially the types definitions. If you have this issue, the only option for now, is to downgrade typescript to a 4.6 version: If you want more details on how to find which module is the one with problems, check my comment from Jun 10 |
Sorry but I am using Typescript 4.5 over here, so there's nothing to downgrade :D |
if you are using webpack4,you can try |
In my case, I have to set |
you need to update ts node globally
|
Thank you it worked |
thanks mate! |
…ces gave me the clue
To avoid an error "Error: Debug Failure. False expression: Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself." cf microsoft/TypeScript#49257
when I update npm package to v4.7.2, npm run build( script: vue-cli-service build ) got error:
It went well if I use v4.6.x.
The text was updated successfully, but these errors were encountered: