@ngtools/webpack - Error encountered resolving symbol values statically
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
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 ...
@Yamilquery same for me I fix it going back to [email protected]
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
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"
}
}
@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.
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.
@SirBrecilos Running the command:
npm update -D && npm update -S
solved it for me. Thanks!
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
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
Thanks @SirBrecilos, I resolved
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.
I resolved this problem by remove all no needed classes from module providers
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" } }
@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
@symphony2014 No. I found a workaround by writing own factory for AuthHttp, so I live with this for now.
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
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.