Skip to content

ngtools npm link #5723

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

Closed
patrikx3 opened this issue Mar 28, 2017 · 7 comments
Closed

ngtools npm link #5723

patrikx3 opened this issue Mar 28, 2017 · 7 comments

Comments

@patrikx3
Copy link

Bug Report or Feature Request (mark with an x)

- [ X] bug report -> please search issues before submitting
- [ ] feature request

Versions.

ERROR in 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 /home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/corifeus-web/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/corifeus-web/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /home/patrikx3/Projects/patrikx3/corifeus/corifeus-app-web-pages/node_modules/corifeus-web/node_modules/@angular/core/core.d.ts

Repro steps.

Any npm link failures.

The log given by the failure.

Given already.

Desired functionality.

Works.

Mention any other details that might be useful.

Simple, just broken.

@tabvn
Copy link

tabvn commented Mar 31, 2017

same issue!

@tabvn
Copy link

tabvn commented Mar 31, 2017

ERROR in 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/toan/Sites/loopcms/backend/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /Users/toan/Sites/loopcms/backend/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /Users/toan/Sites/loopcms/backend/node_modules/@angular/core/core.d.ts

@gingters
Copy link

gingters commented Apr 4, 2017

The issue is that the npm linked packages contain their own copy of the node_modules folder, with their own copies of referenced packages (i.e. @angular/core etc.).

This is perhaps mainly an issue with the typescript compiler itself, and not so much @angular/cli or @angular/compiler. See also: microsoft/TypeScript#6496

A workaround is, to put this in the tsconfig.json compilerOptions element:

    "paths": {
      "@angular/common": [
        "../node_modules/@angular/common"
      ],
      "@angular/compiler": [
        "../node_modules/@angular/compiler"
      ],
      "@angular/core": [
        "../node_modules/@angular/core"
      ],
      "@angular/forms": [
        "../node_modules/@angular/forms"
      ],
      "@angular/platform-browser": [
        "../node_modules/@angular/platform-browser"
      ],
      "@angular/platform-browser-dynamic": [
        "../node_modules/@angular/platform-browser-dynamic"
      ],
      "@angular/router": [
        "../node_modules/@angular/router"
      ],
      "@angular/http": [
        "../node_modules/@angular/http"
      ]
    },

This will tell the compiler to use the main projects copy of these packages and not the nested ones.
However, this requires a change in the projects config that is not necessary when you don't link a package, so this is just a workaround.

It would be best, if the ngc / tsc would ignore nested node_modules when there is an explicit installed module on the top level for that.

@kylecordes
Copy link

@gingters and others - I have had good results working around all this. Lots of details in this repo:

https://github.com/OasisDigital/many-to-many-angular

Example of applying the technique you mentioned:

https://github.com/OasisDigital/many-to-many-angular/blob/master/application/admin/tsconfig.json#L11

@sebelga
Copy link

sebelga commented Apr 11, 2017

@kylecordes thanks for sharing this, looks great!

@filipesilva
Copy link
Contributor

Duplicate of #3854, the answer there is very similar to @gingters's one.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants