Skip to content

@ngtools/webpack - Error encountered resolving symbol values statically #3674

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
ajantsch opened this issue Dec 21, 2016 · 77 comments
Closed

Comments

@ajantsch
Copy link

ajantsch commented Dec 21, 2016

Versions.

Repro steps.

Not really repro steps, but the not-changed webpack config used to work with [email protected] and @ngtools/[email protected], since upgrading I get the error described below and I have no idea what to do about it.

The log given by the failure.

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, resolving symbol AnimationDriver in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts

ERROR in ./src/bootstrap.ts
Module not found: Error: Can't resolve './../$$_gendir/src/app/main.module.ngfactory' in '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/src'
 @ ./src/bootstrap.ts 3:0-83

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/$$_gendir' in '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/bootstrap.ts
@Codenator81
Copy link

angular-cli beta-24
ng build and serve error at finish but dist directory creates:

Hash: 5e16130df6044b0b8bb7
Time: 26102ms
chunk {0} main.f9a9d29d3531b5bb577d.bundle.js, main.f9a9d29d3531b5bb577d.bundle.map (main) 18.7 kB {2} [initial] [rendered]
chunk {1} styles.4a4db805ac49f2977add.bundle.css, styles.4a4db805ac49f2977add.bundle.map, styles.4a4db805ac49f2977add.bundle.map (styles) 1.69 kB {3} [initial] [rendered]
chunk {2} vendor.721d51ad17cc097115fc.bundle.js, vendor.721d51ad17cc097115fc.bundle.map (vendor) 3.28 MB [initial] [rendered]
chunk {3} inline.3ee6c85492759d2c86ad.bundle.js, inline.3ee6c85492759d2c86ad.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in this.symbolResolver.getSymbolByModule is not a function

@Codenator81
Copy link

Also on ng build -prod --aot

ERROR in this.host.isSourceFile is not a function

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/alex/Dev/ng2/tour-of-heroes-angularfire2/src'
 @ ./src/main.ts 4:0-74
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/home/alex/Dev/ng2/tour-of-heroes-angularfire2/src/$$_gendir' in '/home/alex/Dev/ng2/tour-of-heroes-angularfire2/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main

@martinmasse
Copy link

Something similar for me after upgrading

ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 79:22 in the original .ts file), resolving symbol AUTH_PROVIDERS in C:/Xacte2/XacteUI-D/node_modules/angular2-jwt/angular2-jwt.d.ts, resolving symbol AppModule in C:/Xacte2/XacteUI-D/src/app/app.module.ts, resolving symbol AppModule in C:/Xacte2/XacteUI-D/src/app/app.module.ts

@mgarcs
Copy link

mgarcs commented Dec 21, 2016

I have the same issue reported by @martinmasse with angular2-jwt after upgrading.

@alxckn
Copy link

alxckn commented Dec 21, 2016

With ng build --aot I also get a similar error:

ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 7:12 in the original .ts file), resolving symbol Ng2BootstrapConfig in /foo/node_modules/ng2-bootstrap/components/ng2-bootstrap-config.d.ts, resolving symbol TypeaheadContainerComponent in /foo/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts, resolving symbol TypeaheadContainerComponent in /foo/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './app/i18n/app/app.module.ngfactory' in '/foo/src'
 @ ./src/main.ts 4:0-73
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/foo/src/app/i18n' in '/foo/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main

@thinkingmedia
Copy link

I'm getting this error too.

@born2net
Copy link

same issue
https://github.com/PointInside/ng2-toastr/issues/109
also happens with ng2-google maps and other libs...
the good news, at least this version works as 1.22 was no good!
regards

@danmana
Copy link

danmana commented Dec 21, 2016

Had the same issue using angular 2.1.2 and angular-cli 1.0.0-beta.1
I upgraded to angular 2.4.0 and angular-cli 1.0.0-beta.4

After fixing some templateUrl and styleUrls that no longer worked (relative urls have to start with ./ now) everything works again

@born2net
Copy link

my error is:

chunk    {0} main.bundle.js, 0.a8cf7fdcc46f9bd210ec.hot-update.js, main.bundle.map, main.bundle.map (main) 1.16 MB {3} [initial] [rendered]
chunk    {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 324 kB {4} [initial]
chunk    {2} scripts.bundle.js, scripts.bundle.map (scripts) 232 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 6.34 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in Error encountered resolving symbol values statically. Calling function 'ToastOptions', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts

latest everything...

project:
https://github.com/born2net/studioDashboard

@danmana
Copy link

danmana commented Dec 21, 2016

@born2net your issues seems related to angular/angular#11262 (comment)

Check if you have any lambda expressions in your app.module.ts and replace them with export function

@aaronleestic
Copy link

I have the same issue, error encountered resolving static symbol statically, since upgrading from beta.22 / 2.2.3 to beta.24 / 2.4.0

@hansl
Copy link
Contributor

hansl commented Dec 21, 2016

@ajantsch You're trying to compile test files. Try to exclude spec files and test.ts from your tsconfig.json file. If you're using the CLI we do that for you.

@Codenator81 if this.host.isSourceFile is a function and should be working with AOT, please file a separate issue with a project we can look at. New issues that are solved always contain project that we test against to avoid regressions in the future, so they really really help.

@martinmasse @mgarcs angular2-jwt does not seem to be compatible with Angular > 2.3.x. https://unpkg.com/[email protected]/ they didn't publish metadata. I reported this to our relation team and they'll contact them.

@aaronleeucla please provide a reproduction project we can look at. This is not helpful. Please file a separate issue with a project we can look at. New issues that are solved always contain project that we test against to avoid regressions in the future, so they really really help.

Closing this issue; the original issue is a configuration issue on the part of the creator and I gave him a fix.

@hansl hansl closed this as completed Dec 21, 2016
@born2net
Copy link

the issue is deeper as you can see here:
https://github.com/PointInside/ng2-toastr/issues/109#issuecomment-268609244
it appears to happen anytime you call forRoot (or method on module)

 NgReduxModule.forRoot()

@born2net
Copy link

please open bug or reference a diff one.
even using the popular angular 2 google maps results in same issue:
https://github.com/SebastianM/angular2-google-maps

error:

err

@ajantsch
Copy link
Author

ajantsch commented Dec 21, 2016

@hansl spec files should be excluded by my webpack config:

{
    test: /\.(ts|tsx)$/,
    exclude: [isTest ? /\.(e2e)\.(ts|tsx)$/ : /\.(spec|e2e)\.(ts|tsx)$/],
    loaders: isProd ? ['@ngtools/webpack'] : [{loader: 'awesome-typescript-loader', query: awesomeTypescriptLoaderOptions}, 'angular2-template-loader']
},

isTest and isProd are set based on the npm command used, in the case mentioned isTest is false and isProd is true.

edit:
My AotPlugin config is also pretty straight forward:

new AotPlugin({
    tsConfigPath: './tsconfig.json',
    entryModule: './src/app/main.module#MainModule'
}),

@hansl
Copy link
Contributor

hansl commented Dec 21, 2016

@ajantsch you need to exclude them from the tsconfig as well. We use the tsconfig for analyzing your code statically.

@ajantsch
Copy link
Author

@hansl I tried this now, have excluded *.spec.ts files in my tsconfig, but the error stays the same.

@hansl
Copy link
Contributor

hansl commented Dec 21, 2016

@ajantsch did you exclude test.ts?

The error you're seeing is this (from your own log):

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, resolving symbol AnimationDriver in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts

The last part (copied here):

resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts

Is trying to resolve BrowserTestingModule, which should only be used in tests. If you're using that module in your own code then you shouldn't. The most likely explanation is you still have some test code in your build.

@ajantsch
Copy link
Author

@hansl that was actually true, I forgot to exclude the karma-main.ts. Now I'm down to only one more error:

ERROR in Could not resolve "./src/app/main.module" from "./src/app/main.module".
```

@gilbertogwa
Copy link

Me too... working with angular-cli is being so painful..

Could not resolve "app/+home/home.module" from "/src/app/app.module.ts".

@ajantsch
Copy link
Author

My last mentioned error went away (and AoT compilation is now working again for me) after specifying 'mainPath' in my AoTPlugin.

@gilbertogwa
Copy link

gilbertogwa commented Dec 22, 2016

About my problem (Could not resolve "app/+home/home.module" from "/src/app/app.module.ts"). I changed the routing

FROM:
export const routes: Routes = [
{
path: '',
component: MainLayoutComponent,
children: [
{
path:'',
children: [
{
path: 'home',
loadChildren: 'app/+home/home.module#HomeModule'
}]
}
]
}
];

TO:

export const routes: Routes = [
{
path: '',
component: MainLayoutComponent,
children: [
{
path:'',
children: [
{
path: 'home',
loadChildren: './+home/home.module#HomeModule'
}]
}
]
}
];

@Likon84
Copy link

Likon84 commented Dec 22, 2016

This Angular-cli is completely not ready for working with it...

@dessalines
Copy link

I just ran into this problem, installing all the latest dependencies, and trying to run ng serve --prod --aot today. This should be reopened.

@born2net
Copy link

agreed...

@nikoxgon
Copy link

See next. I found a solution for me.

I hope this helps.

@avatsaev
Copy link

This is preventing production deploys, isn't it?

@RicardoVaranda
Copy link
Contributor

Please make sure you delete your project dependencies of the old angular-cli in your package.json using:

npm uninstall --save angular-cli

An issue was having the same error as stated above and I found this to be the solution, might be helpful for someone else.

@dereekb
Copy link

dereekb commented Mar 5, 2017

I fixed this issue by removing all function calls from my static forRoot() functions. I replaced those functions with factory functions declared/referenced by the provider instead.

So in @marioleed's cases that didn't work (1-3) you can see that functions were called during configuration, whereas on the others they are objects using the Typescript Class as an Interface.

There's probably a good reason for not allowing arbitrary functions to be called at the configuration stage, but I'm too new to Angular to comment on exactly why.

@miton18
Copy link

miton18 commented Mar 15, 2017

Any solution ?

@pierfreeman
Copy link

Keep getting this error with ng serve:

ERROR in this.symbolResolver.getSymbolByModule is not a function

with angular and angular/cli latest version. Since my project relies on primeng ultima template, I'm Trying to keep my project as close as possible to ultima demo project, which compiles correctly whereas mine doesn't.

@knvpk
Copy link

knvpk commented Mar 28, 2017

Ant solution for this. Im facing this issue.

@Yamilquery
Copy link

Yamilquery commented Apr 12, 2017

Help, I'm getting the same...

Nativescript It has been a headache!

 [820] ../~/nativescript-css-loader!./platform.ios.css 412 bytes [built]
 [821] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB [built]
    + 807 hidden modules

WARNING in ./app.css
  resolve-url-loader cannot operate: CSS error
  /Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/app/app.css:6:37: property missing ':'
  at error (/Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/node_modules/css/lib/parse/index.js:62:15)

ERROR in this.symbolResolver.getSymbolByModule is not a function
Child app/app.component.html:
       [0] ./app.component.html 62 bytes {0} [built]
Child app/login/login.component.html:

    WARNING in ../~/resolve-url-loader!../~/nativescript-css-loader!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css
      resolve-url-loader cannot operate: CSS error
      /Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/app/app.css:6:37: property missing ':'
      at error (/Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/node_modules/css/lib/parse/index.js:62:15)
child process exited with code 2

In the morning it worked perfect and suddenly stopped working ...

@sylphir
Copy link

sylphir commented Apr 12, 2017

@Yamilquery same for me I fix it going back to [email protected]

@bvanbleyenbergh
Copy link

I managed to make it work after getting the same error: error in this.symbolResolver.getSymbolByModule is not a function webpack: Failed to compile.

I used this command to update all the packages npm update -D && npm update -S (source) did this 2-3 times and my app ran without any problems (ng serve).

@angular/cli: 1.0.0
node: 6.9.5
os: win32 x64
@angular/common: 4.0.2
@angular/compiler: 4.0.2
@angular/core: 4.0.2
@angular/forms: 4.0.2
@angular/http: 4.0.2
@angular/platform-browser: 4.0.2
@angular/platform-browser-dynamic: 4.0.2
@angular/router: 4.0.2
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.2

@Yamilquery
Copy link

Yamilquery commented Apr 12, 2017

Thanks for your attention, I updated my version of angular 4.0.2, I executed the command npm update -D && npm update -S

I deleted the folders:

sudo rm -rf platforms/ node_modules/ hooks/

Later.

tns run ios --bundle

And

npm run build-ios-bundle -- --release --for-device --teamId <MYTEAMID>

It worked excellent, thank you very much!

This is my package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.dtech.levenmasdev",
    "tns-android": {
      "version": "2.5.0"
    },
    "tns-ios": {
      "version": "2.5.0"
    }
  },
  "dependencies": {
    "@angular/animations": "4.0.2",
    "@angular/common": "4.0.2",
    "@angular/compiler": "4.0.2",
    "@angular/core": "4.0.2",
    "@angular/forms": "4.0.2",
    "@angular/http": "4.0.2",
    "@angular/platform-browser": "4.0.2",
    "@angular/platform-browser-dynamic": "4.0.2",
    "@angular/cli": "1.0.0",
    "@angular/router": "4.0.2",
    "email-validator": "^1.0.7",
    "moment": "^2.18.1",
    "nativescript-angular": "1.5.1",
    "nativescript-gif": "^1.0.61",
    "nativescript-imagepicker": "^2.5.1",
    "nativescript-iqkeyboardmanager": "^1.0.1",
    "nativescript-phone": "^1.2.4",
    "nativescript-theme-core": "~1.0.2",
    "nativescript-webview-interface": "^1.4.1",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.2.0",
    "tns-core-modules": "^2.5.2",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~4.0.2",
    "@ngtools/webpack": "1.2.13",
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.16.1",
    "copy-webpack-plugin": "~3.0.1",
    "extract-text-webpack-plugin": "~2.0.0-beta.4",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "~0.3.5",
    "nativescript-dev-webpack": "^0.3.7",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~1.6.0",
    "typescript": "~2.1.0",
    "webpack": "2.2.0",
    "webpack-sources": "~0.1.3"
  },
  "scripts": {
    "ns-bundle": "ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  }
}

@yurykazakov
Copy link

yurykazakov commented Apr 12, 2017

@Yamilquery we got the same error today. We had angular 4.0.1 libraries with angular/cli 1.0.0-rc.2 in our package.json.

angular/cli 1.0.0-rc.2 getting the latest version of angular/compiler-cli according its dependencies. (4.0.2 at this moment). And angular/compiler-cli 4.0.2 has angular/compiler 4.0.2 in peerDependencies, but it was not installed.

So, in our case update from angular 4.0.1 to 4.0.2 solved this error.

@dessalines
Copy link

I'm still back on angular2, all I had to do was add the @angular/compiler-cli dependency to match the version of my @angular/compiler to fix this.

@jsdevtom
Copy link

@SirBrecilos Running the command:

npm update -D && npm update -S

solved it for me. Thanks!

@KostyaTretyak
Copy link

KostyaTretyak commented Apr 18, 2017

I'm getting a very similar error:

ERROR in Error encountered resolving symbol values statically. Could not resolve type TabId (position 12:23 in the original .ts file), resolving symbol OptionsTabs in /var/www/hub.org.ua/angular/src/app/tab/tab.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/var/www/hub.org.ua/angular/src'
@ ./src/main.ts 4:0-74
@ multi ./src/main.ts

Where type TabId and OptionsTab:

export type TabId = 'unread' | 'readLater' | 'read' | 'favorites' | 'trash';

export class OptionsTabs
{
  constructor
  (
    public title: string
    ,public classIcon: string
    ,public setInTab: TabId
  ){}
}

ng throw the error only when I do ng build --prod or ng build --aot. But when I do just ng build - all works as expected.

I have:

@angular/cli: 1.0.0
node: 7.9.0
os: linux x64
@angular/common: 4.0.2
@angular/compiler: 4.0.2
@angular/core: 4.0.2
@angular/forms: 4.0.2
@angular/http: 4.0.2
@angular/platform-browser: 4.0.2
@angular/platform-browser-dynamic: 4.0.2
@angular/router: 4.0.2
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.2

@TechSnake
Copy link

Hello guys I am so happy you could find a solution your problem.

I am trying to find a solution for mine here is the problem

> ionic-app-scripts build "--release" "--prod"

[14:43:39]  ionic-app-scripts 1.3.4
[14:43:39]  build prod started ...
[14:43:39]  clean started ...
[14:43:39]  clean finished in less than 1 ms
[14:43:39]  copy started ...
[14:43:39]  ngc started ...
[14:43:51]  ionic-app-script task: "build"
[14:43:51]  Error: Error encountered resolving symbol values statically. Could not resolve ionic-native relative to
            C:/Users/home/benimsozluk/src/app/app.module.ts., resolving symbol AppModule in
            C:/Users/home/benimsozluk/src/app/app.module.ts, resolving symbol AppModule in
            C:/Users/home/benimsozluk/src/app/app.module.ts
Error: Error encountered resolving symbol values statically. Could not resolve ionic-native relative to C:/Users/home/benimsozluk/src/app/app.module.ts., resolving symbol AppModule in C:/Users/home/benimsozluk/src/app/app.module.ts, resolving symbol AppModule in C:/Users/home/benimsozluk/src/app/app.module.ts
    at Error (native)
    at syntaxError (C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:1513:34)
    at simplifyInContext (C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:23375:23)
    at StaticReflector.simplify (C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:23387:13)
    at StaticReflector.annotations (C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:22836:41)
    at NgModuleResolver.resolve (C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:13364:70)
    at CompileMetadataResolver.getNgModuleMetadata (C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:13949:60)
    at addNgModule (C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:22555:58)
    at C:\Users\home\benimsozluk\node_modules\@angular\compiler\bundles\compiler.umd.js:22566:14
    at Array.forEach (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! BenimSozluk@ ionic:build: `ionic-app-scripts build "--release" "--prod"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the BenimSozluk@ ionic:build script 'ionic-app-scripts build "--release" "--prod"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the BenimSozluk package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build "--release" "--prod"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs BenimSozluk
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls BenimSozluk
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\home\AppData\Roaming\npm-cache\_logs\2017-04-19T11_43_52_003Z-debug.log

These are my npm debug

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'ionic:build',
1 verbose cli   '--',
1 verbose cli   '--release',
1 verbose cli   '--prod' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Invalid name: "Benim Sözlük"
4 verbose stack     at ensureValidName (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:336:15)
4 verbose stack     at Object.fixNameField (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\fixer.js:215:5)
4 verbose stack     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:32:38
4 verbose stack     at Array.forEach (native)
4 verbose stack     at normalize (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\normalize-package-data\lib\normalize.js:31:15)
4 verbose stack     at final (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:349:5)
4 verbose stack     at then (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:124:5)
4 verbose stack     at ReadFileContext.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:295:20)
4 verbose stack     at ReadFileContext.callback (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16)
4 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
5 verbose cwd C:\Users\home\benimsozluk
6 error Windows_NT 10.0.10586
7 error argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:build" "--" "--release" "--prod"
8 error node v6.9.4
9 error npm  v3.10.10
10 error Invalid name: "Benim Sözlük"
11 error If you need help, you may report this error at:
11 error     <https://github.com/npm/npm/issues>
12 verbose exit [ 1, true ]

My package json

"dependencies": {
"@angular/common": "4.0.2",
"@angular/compiler": "4.0.2",
"@angular/compiler-cli": "4.0.2",
"@angular/core": "4.0.2",
"@angular/forms": "4.0.2",
"@angular/http": "4.0.2",
"@angular/platform-browser": "4.0.2",
"@angular/platform-browser-dynamic": "4.0.2",
"@angular/platform-server": "4.0.2",
"@ionic-native/core": "3.5.0",
"@ionic-native/local-notifications": "3.5.0",
"@ionic/storage": "2.0.1",
"ionic-angular": "3.0.1",
"ionic-native": "3.5.0",
"ionicons": "3.0.0",
"rxjs": "5.3.0",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.5"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.4",
"typescript": "2.2.2"

Any Help Please Thank you in Advance

@hungnm92
Copy link

hungnm92 commented Apr 21, 2017

Thanks @SirBrecilos, I resolved

@phkroll
Copy link

phkroll commented Apr 25, 2017

Also had the Problem with "ERROR in this.symbolResolver.getSymbolByModule is not a function
webpack: Failed to compile."
Changing the Compiler from es5 to es6 did the trick for me.

@KostyaTretyak
Copy link

I resolved this problem by remove all no needed classes from module providers

@dtarczynski
Copy link

dtarczynski commented Oct 23, 2017

I'm using Angular application bootstrapped from dotnet new angular command. When I run manualy command (or do publish from VS that fires this command for me): webpack --env.prod gives me error:

ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of
 this variable is needed by the template compiler (position 80:22 in the original .ts file), resolving symbol AUTH_PROVIDERS in C:/Users/dtarc/sou
rce/repos/Codmatic/Codmatic.Web/node_modules/angular2-jwt/angular2-jwt.d.ts, resolving symbol AppModuleShared in C:/Users/dtarc/source/repos/Codma
tic/Codmatic.Web/ClientApp/app/app.module.shared.ts, resolving symbol AppModuleShared in C:/Users/dtarc/source/repos/Codmatic/Codmatic.Web/ClientA
pp/app/app.module.shared.ts

ERROR in ./ClientApp/boot.server.ts
Module not found: Error: Can't resolve './../$$_gendir/ClientApp/app/app.module.server.ngfactory' in 'C:\Users\dtarc\source\repos\Codmatic\Cod
matic.Web\ClientApp'
 @ ./ClientApp/boot.server.ts 8:0-94

This happens when I add AUTH_PROVIDERS from angular2-jwt to my app module providers section.
f.ex:

providers : [
    AUTH_PROVIDERS,
//rest

package.json

"dependencies": {
"@angular/animations": "4.2.5",
"@angular/common": "4.2.5",
"@angular/compiler": "4.2.5",
"@angular/compiler-cli": "4.2.5",
"@angular/core": "4.2.5",
"@angular/forms": "4.2.5",
"@angular/http": "4.2.5",
"@angular/platform-browser": "4.2.5",
"@angular/platform-browser-dynamic": "4.2.5",
"@angular/platform-server": "4.2.5",
"@angular/router": "4.2.5",
"@ngtools/webpack": "1.5.0",
"@types/webpack-env": "1.13.0",
"angular2-jwt": "^0.2.3",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.1",
"awesome-typescript-loader": "3.2.1",
"bootstrap": "3.3.7",
"css": "2.2.1",
"css-loader": "0.28.4",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "0.7.3",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.2",
"font-awesome": "^4.7.0",
"html-loader": "0.4.5",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"ng2-toasty": "^4.0.3",
"preboot": "4.5.2",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.10",
"rxjs": "5.4.2",
"style-loader": "0.18.2",
"to-string-loader": "1.1.5",
"typescript": "2.4.1",
"url-loader": "0.5.9",
"webpack": "2.5.1",
"webpack-hot-middleware": "2.18.2",
"webpack-merge": "4.1.0",
"zone.js": "0.8.12"
},
"devDependencies": {
"@angular/cli": "^1.4.9",
"@types/chai": "4.0.1",
"@types/jasmine": "2.5.53",
"chai": "4.0.2",
"jasmine-core": "2.6.4",
"karma": "1.7.0",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-webpack": "2.0.3"
}
}

@symphony2014
Copy link

symphony2014 commented Oct 27, 2017

@dtarczynski , fixed for now? I got same issues:

ERROR in Error encountered resolving symbol values statically. Could not resolve type Config (position 84:77 in the original .ts file), resolving symbol ɵcq in D:/svn/Re
port-server/trank/Report/report-runtime2/node_modules/ng-zorro-antd/index.d.ts

ERROR in ./src/boot.server.ts
Module not found: Error: Can't resolve './../$$_gendir/config/src/app/app.module.server.ngfactory' in 'D:\svn\Report-server\trank\Report\report-runtime2\src'
 @ ./src/boot.server.ts 9:38-106

@dtarczynski
Copy link

dtarczynski commented Oct 27, 2017

@symphony2014 No. I found a workaround by writing own factory for AuthHttp, so I live with this for now.

@TsholoPole
Copy link

Getting the same error.
ng build --env=prod --output-hashing none seems to fix it but it might have a negative effect on the final project

@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