Definitelytyped: v14.6.3 has error in node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax.

Created on 3 Sep 2020  Â·  12Comments  Â·  Source: DefinitelyTyped/DefinitelyTyped

our project used Angular6 and typescript 2.9.2。
after @types/node upgrading to 14.6.3 , npm build failed with error,

node_modules/@types/node/index.d.ts(20,1): error TS1084: Invalid 'reference' directive syntax.

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/9a5105e065d9c9513561c2e0721768d6ab77873a/types/node/v6/index.d.ts#L14-L20

reference lib is add in typescript 3.0, not worked in typescript 2.x

Most helpful comment

This was the same issue for us and we fixed it by using a fixed version (14.6.2) of @types/node in our devDependencies in the package.json.
package.json { "name": "some-library", "version": "1.2.3", "description": "Some library", "files": [ "lib" ], "main": "lib/index.js", "scripts": { }, "devDependencies": { "@types/node": "14.6.2", "ts-node": "^8.0.2", "typescript": "^2.9.1" }, "dependencies": { "@types/long": "^4.0.0", "long": "^4.0.0" }, "engines": { "node": "~10" } }

All 12 comments

I can say the same with types/node 11.15.21. Our project stopped building today and we had to freeze the version on 11.15.20. There are more errors found than that one. Here is the list that broke our build in case it is helpful. We are not using TS 3 either.

node_modules/@types/node/assert.d.ts(2,68): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(22,68): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(31,94): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(31,101): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(31,104): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(33,98): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(33,105): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(33,108): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(41,47): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(41,53): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(41,56): error TS1005: ';' expected.
node_modules/@types/node/base.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(11,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(12,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(13,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(11,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(12,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(13,1): error TS1084: Invalid 'reference' directive syntax.

Same, our project that is pinned at TypeScript 2.9.2 but didn't have types/node pinned now throws the exact errors as posted above.

This is because DefinitelyTyped no longer supports TypeScript 2, as per the support table in the readme.

You'll have to update to TypeScript 3.2 or above to be able to consume the latest version of @types/node :)

I am having the exact same problem but the project I am working on is using 6.x.x for @Types

Any ideas for a work around? This is currently blocking my builds.

According to README:

@types packages have tags for versions of TypeScript that they explicitly support, so you can usually get older versions of packages that predate the 2-year window. For example, if you run npm dist-tags @types/react, you'll see that TypeScript 2.5 can use types for [email protected], whereas TypeScript 2.6 and 2.7 can use types for [email protected]:

This means, if you have TypeScript 3.1 or older, you should use older versions of @types/node as indicated by NPM tags.

This was the same issue for us and we fixed it by using a fixed version (14.6.2) of @types/node in our devDependencies in the package.json.
package.json { "name": "some-library", "version": "1.2.3", "description": "Some library", "files": [ "lib" ], "main": "lib/index.js", "scripts": { }, "devDependencies": { "@types/node": "14.6.2", "ts-node": "^8.0.2", "typescript": "^2.9.1" }, "dependencies": { "@types/long": "^4.0.0", "long": "^4.0.0" }, "engines": { "node": "~10" } }

Hi guys! We are suffering the same problem here! How can we avoid to have to update to the last version of typescript? We are using version 2.2.1.

I can say the same with types/node 11.15.21. Our project stopped building today and we had to freeze the version on 11.15.20. There are more errors found than that one. Here is the list that broke our build in case it is helpful. We are not using TS 3 either.

node_modules/@types/node/assert.d.ts(2,68): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(22,68): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(31,94): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(31,101): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(31,104): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(33,98): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(33,105): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(33,108): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(41,47): error TS1144: '{' or ';' expected.
node_modules/@types/node/assert.d.ts(41,53): error TS1005: ';' expected.
node_modules/@types/node/assert.d.ts(41,56): error TS1005: ';' expected.
node_modules/@types/node/base.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(11,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(12,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/base.d.ts(13,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(10,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(11,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(12,1): error TS1084: Invalid 'reference' directive syntax.
node_modules/@types/node/ts3.6/base.d.ts(13,1): error TS1084: Invalid 'reference' directive syntax.

i am facing this issue now what is the solution for this issue, i changed the node/types version also its not working any suggestion..

@PoovarasanSekar the solution is migrate to vue. This project has not backward compatibility.

Angular versions ^4.0.0, ^5.0.0, ^6.0.0 and ^7.0.0 are no longer under support.
And ^8.0.0 LTS ends on Nov 28, 2020.
https://angular.io/guide/releases#support-policy-and-schedule
The best solution is upgrade to [email protected] with [email protected] support

@Semigradsky I don't think that upgrade to angular 9 could be a solution, at least, no on long term.
What does it means 'LONG TERM' for angular? 12 months. https://angular.io/guide/releases

I think LONG TERM could means something like JAVA do. I mean, Java 8 was released on March 2014 and its support has been extended to 2030. 16 years! That's long term.

@PoovarasanSekar you should take in account LTS, how much does it cost to you to change framework at this time vs. how much will cost to you to change angular in one year from now.

Was this page helpful?
0 / 5 - 0 ratings