angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Getting Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable

Open xtianus79 opened this issue 9 years ago • 61 comments

OS?

MacOS Sierre

Versions.

angular-cli: 1.0.0-beta.19-3 node: 6.2.2 os: darwin x64

Repro steps.

Getting this error with using Angular CLI

Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /Users/mbp06/Repos/multiple-date-picker-a2/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in /Users/mbp06/Repos/multiple-date-picker-a2/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in /Users/mbp06/Repos/multiple-date-picker-a2/node_modules/@angular/core/src/di/opaque_token.d.ts

xtianus79 avatar Feb 13 '17 04:02 xtianus79

@gnesher I do not hope so. We have enough challenges in our code, we don't need challenges in foreign code also :-) So what can we do? I need to compile the code to get in running on our server.

ghost avatar Apr 04 '17 08:04 ghost

@n4uoase you can try to reach out to the developers through gitter, they are usually responsive and will try to help - though frankly that fact that they've not updated the docs to reflect these problems after 7 months means this can't be a mistake. Personally I've decided to switch frameworks on all new projects. I'm only here trying to maintain a single legacy application. It's funny how an Angular2 application became legacy after 6 months of use...

gnesher avatar Apr 04 '17 10:04 gnesher

I got the same error upgrading from angular 2.4 to angular 4.0.

The library I was relying on had angular 2.4 as a dependency in their package.json. Changing that to a more relaxed peerDependency >2.4 or devDependency >2.4, fixed the issue for me.

Simon-Briggs avatar Apr 05 '17 02:04 Simon-Briggs

Simon could you explain in detail what you did? I am getting the same error. it would be a great help.

chinenyem avatar Apr 05 '17 03:04 chinenyem

In the failing library's package.json I changed:

"dependencies": {
    "@angular/common": "^2.3.1",
    etc....
}

to

"peerDependencies": {
    "@angular/common": ">=2.3.1",
    etc....
}

Simon-Briggs avatar Apr 05 '17 04:04 Simon-Briggs

Fix it with thanks to the post of @Simon-Briggs. Of course this implies to be able to update the module causing the problem.

Orodan avatar Apr 05 '17 14:04 Orodan

Are these third party modules you are referring to? Could you give an example of one? My app doesn't use any non-official Angular modules, so I can't imagine this solves it for me.

code-tree avatar Apr 06 '17 02:04 code-tree

Hi, I think this bug is teasing us one by one.

  • I am running angular 4; (after experiencing the problem updated all my node modules dependencies to latest see at the end the versions I am using)
  • my editor is VS code;
  • all is running fine this morning (and I might add I was seeing for the first time my app running as intended end to end). Then I was prompted to update VSC which I did.
  • And started getting the error

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 24:10 in the original .ts file), resolving symbol Model_Instance_Generator .....

I am injecting the model factory using an exported def from model_factory.ts file. If I remove the provider injected at module level it builds but this is not a solution for me. I spent the last 4 hours struggling to solve this with no avail ... Please if someone knows why we started experiencing this I appreciate the help ...

/ \ _ __ __ _ _ | | __ _ _ __ / | | | | / △ \ | ' \ / _ | | | | |/ _ | '| | | | | | | / ___ | | | | (| | || | | (| | | | || | | | // __| ||_, |_,||_,|| _||| |___/ @angular/cli: 1.0.0 (e) node: 7.7.4 os: win32 x64 @angular/animations: 4.0.1 @angular/common: 4.0.1 @angular/compiler: 4.0.1 @angular/compiler-cli: 4.0.1 @angular/core: 4.0.1 @angular/forms: 4.0.1 @angular/http: 4.0.1 @angular/platform-browser: 4.0.1 @angular/platform-browser-dynamic: 4.0.1 @angular/platform-server: 4.0.1 @angular/router: 4.0.1 @angular/cli: 1.0.0

bammadamma avatar Apr 06 '17 14:04 bammadamma

Can u provide the entire error message? On Thu, Apr 6, 2017 at 10:40 AM bammadamma [email protected] wrote:

Hi, I think this bug is teasing us one by one.

  • I am running angular 4; (after experiencing the problem updated all my node modules dependencies to latest see at the end the versions I am using)

  • my editor is VS code;

  • all is running fine this morning (and I might ass I was seeing for the first time my app running as intended end to end). Then I was prompted to update VSC which I did.

  • And started getting the error

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 24:10 in the original .ts file), resolving symbol Model_Instance_Generator .....

I am injecting the model factory using an exported def from model_factory.ts file.

If I remove the provider injected at module level it builds but this is not a solution for me.

I spent the last 4 hours struggling to solve this with no avail ...

Please if someone knows why we started experiencing this I appreciate the help ...

/ \ _ __ __ _ _

| | __ _ _ __ / | | | |/ △ \ | ' \ / _| | | | |/ _ | '| | | | | | |/ ___ | | | | (| | || | | (| | | | |

| |___ | |// __| ||_, |,|*|,|| _|**|*_|

|___/

@angular/cli: 1.0.0 (e)

node: 7.7.4

os: win32 x64

@angular/animations: 4.0.1

@angular/common: 4.0.1

@angular/compiler: 4.0.1

@angular/compiler-cli: 4.0.1

@angular/core: 4.0.1

@angular/forms: 4.0.1

@angular/http: 4.0.1

@angular/platform-browser: 4.0.1

@angular/platform-browser-dynamic: 4.0.1

@angular/platform-server: 4.0.1

@angular/router: 4.0.1

@angular/cli: 1.0.0

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/4647#issuecomment-292195484, or mute the thread https://github.com/notifications/unsubscribe-auth/AH3Thcb1bkrow3TIAVv0y87HOVk7iOamks5rtPlkgaJpZM4L-xjH .

chinenyem avatar Apr 06 '17 15:04 chinenyem

@chinenyem thank you below is the full error message ...

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 24:10 in the original .ts file), resolving symbol Model_Instance_Generator in D:/projectfinmal/finmal_poc/fml-new/fmlpoc/src/services/wp/model_factory.ts, resolving symbol Model_Instance_GeneratorDef in D:/projectfinmal/finmal_poc/fml-new/fmlpoc/src/services/wp/model_factory.ts, resolving symbol Model_Instance_GeneratorDef in D:/projectfinmal/finmal_poc/fml-new/fmlpoc/src/services/wp_service.ts, resolving symbol AppModule in D:/projectfinmal/finmal_poc/fml-new/fmlpoc/src/app/app-module.ts, resolving symbol AppModule in D:/projectfinmal/finmal_poc/fml-new/fmlpoc/src/app/app-module.ts

bammadamma avatar Apr 06 '17 15:04 bammadamma

Thanks now can u provide the code for model_factory.ts.

chinenyem avatar Apr 06 '17 16:04 chinenyem

Hi, @chinenyem ( Thank you for your help will update when I know further about the error or if it recurs again)

removed node_module and reinstalled again afresh; tried to npm run build. It failed with the same error message; then removed the factory provider, it built but can not run it as it is buggy because of the removed instance generator; finally put back the provider and this time started it using npm start ( I am using custom webpack after ejecting hence the npm start rather than ng server)

to my surprise, it worked no more the error. I am very puzzled, when I know why it worked I will post but for the time being with all my confusion I will keep on developing and keep an eye on it.

bammadamma avatar Apr 06 '17 16:04 bammadamma

Same error happening here after upgrading Ionic 2 to Ionic 3. Why has been this issue closed?

FrancescoMussi avatar Apr 11 '17 13:04 FrancescoMussi

Any solution so far?!

sabrio avatar Apr 12 '17 17:04 sabrio

@Simon-Briggs that worked for me dude! Thank you!!! 🌚

manjot-cams avatar Apr 12 '17 17:04 manjot-cams

Using ng build --prod --aot=false you wont face this problems hopefully and I also went throw all of the errors and fixed them which took me about a day and in the end the results are as follow: ng build --prod 4.20MB(without assets) ng build --prod --aot=false 4.19MB(without assets) Angular: 4.0.2 CLI: 1.0.0 Hope u find it useful.

sabrio avatar Apr 13 '17 17:04 sabrio

@sabrio This will use the JiT compiler, which will give a bigger and slower app - something AoT is designed to avoid.

larssn avatar Apr 26 '17 08:04 larssn

@larssn It may decrease the performance (I am not sure about this) but in term of size it is almost the same, I have at least 20 component and huge app and the result are the same.

sabrio avatar Apr 26 '17 09:04 sabrio

@sabrio Well when using JiT, the templates are compiled dynamically at runtime, by the client. AoT compiles them at compile-time.

larssn avatar Apr 26 '17 10:04 larssn

And if you use AoT you should be able to remove the dependency on "@angular/platform-browser-dynamic", which in turn should make your build smaller.

larssn avatar Apr 26 '17 10:04 larssn