When I try to run my SPA which is referencing Angular 5 with .net core 2, I receive the following error message;
An unhandled exception occurred while processing the request.
NodeInvocationException: StaticInjectorError(e)[s -> i]:
StaticInjectorError(Platform: core)[s -> i -> InjectionToken DocumentToken]:
Right-hand side of 'instanceof' is not an object
TypeError: StaticInjectorError(e)[s -> i]:
StaticInjectorError(Platform: core)[s -> i -> InjectionToken DocumentToken]:
Right-hand side of 'instanceof' is not an object
at bt (C:\....\ClientApp\dist\main-server.js:92:81462)
at vt (C:\....\ClientApp\dist\main-server.js:92:81337)
at nn (C:\....\ClientApp\dist\main-server.js:92:104108)
at nn (C:\....\ClientApp\dist\main-server.js:92:104227)
at rn (C:\....\ClientApp\dist\main-server.js:92:103904)
at Ce (C:\....\ClientApp\dist\main-server.js:92:77511)
at We.insertToken (C:\....\ClientApp\dist\main-server.js:92:80723)
at C:\....\ClientApp\dist\main-server.js:92:84001
at Rt (C:\....\ClientApp\dist\main-server.js:92:84016)
at Qe (C:\....\ClientApp\dist\main-server.js:92:78997)
Can anyone point out what this means,a sI have tried looking on the internet for a solution with no success.
My packages.json file is as follows;
{
"name": "Services.Public",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.0.0",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/router": "^5.0.0",
"bootstrap": "4.0.0",
"core-js": "^2.5.3",
"jquery": "3.2.1",
"popper.js": "1.14.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.20"
},
"devDependencies": {
"#angular/cli": "^1.6.3",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^5.0.0",
"#angular/platform-server": "^5.0.0",
"#angular-devkit/core": "^0.4.6",
"#ngtools/webpack": "^1.10.2",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"#types/webpack-env": "1.13.5",
"angular2-router-loader": "0.3.5",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.3",
"awesome-typescript-loader": "4.0.1",
"codelyzer": "^4.0.1",
"extract-text-webpack-plugin": "v4.0.0-alpha.0",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.9",
"html-loader": "0.4.5",
"html-webpack-plugin": "^3.0.7",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "^1.7.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "^1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"to-string-loader": "1.1.5",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "^2.7.2",
"webpack": "^4.2.0",
"webpack-addons": "^1.1.5",
"webpack-cli": "^2.0.12",
"webpack-hot-middleware": "2.21.2",
"webpack-merge": "4.1.2"
}
}
The output I get from running webpack --config ./webpack.config.vendor.js is;
Hash: b39fc415a48442d6bfc65aba8dd7f82786abce7b
Version: webpack 4.2.0
Child
Hash: b39fc415a48442d6bfc6
Time: 15305ms
Built at: 2018-3-22 14:08:33
Asset Size Chunks Chunk Names
vendor.js 1.12 MiB 0 [emitted] [big] vendor
vendor.css 174 KiB 0 [emitted] vendor
Entrypoint vendor [big] = vendor.js vendor.css
WARNING in ./node_modules/#angular/core/esm5/core.js
6558:15-36 Critical dependency: the request of a dependency is an expression
# ./node_modules/#angular/core/esm5/core.js
# dll vendor
WARNING in ./node_modules/#angular/core/esm5/core.js
6578:15-102 Critical dependency: the request of a dependency is an expression
# ./node_modules/#angular/core/esm5/core.js
# dll vendor
WARNING in ./node_modules/#angular/core/esm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
# dll vendor 6558:15-36
WARNING in ./node_modules/#angular/core/esm5/core.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
# dll vendor 6578:15-102
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
vendor.js (1.12 MiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
vendor (1.29 MiB)
vendor.js
vendor.css
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Child extract-text-webpack-plugin node_modules/extract-text-webpack-plugin/dist node_modules/css-loader/index.js!node_modules/bootstrap/dist/css/bootstrap.css:
Entrypoint undefined = extract-text-webpack-plugin-output-filename
Child
Hash: 5aba8dd7f82786abce7b
Time: 20483ms
Built at: 2018-3-22 14:08:38
Asset Size Chunks Chunk Names
vendor.js 1.27 MiB 0 [emitted] vendor
Entrypoint vendor = vendor.js
WARNING in ./node_modules/#angular/core/bundles/core.umd.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
# dll vendor 6596:15-36
WARNING in ./node_modules/#angular/core/bundles/core.umd.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
# dll vendor 6616:15-102
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
So only warnings, and the output of running the `webpack` command is;
webpack : (node:7008) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
At line:1 char:1
+ webpack
+ ~~~~~~~
+ CategoryInfo : NotSpecified: ((node:7008) Dep....hooks` instead:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Hash: 58a796a24931610be875f5c7580494b98900c7b1
Version: webpack 4.2.0
Child
Hash: 58a796a24931610be875
Time: 8565ms
Built at: 2018-3-22 14:10:02
Asset Size Chunks Chunk Names
main-client.js 28 KiB 0 [emitted] main-client
main-client.js.map 99.8 KiB 0 [emitted] main-client
Entrypoint main-client = main-client.js main-client.js.map
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
Child
Hash: f5c7580494b98900c7b1
Time: 8333ms
Built at: 2018-3-22 14:10:02
Asset Size Chunks Chunk Names
main-server.js 2.73 MiB 0 [emitted] main-server
Entrypoint main-server = main-server.js
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
I have tried cleaning the cache and reinstalling all modules with no success.
Thank you in advance, and any help is appreciated.
Are you using UseWebpackDevMiddleware() in your Setup.cs file?
I ran into this issue just recently, and it appears to be related to using that configuration. Try commenting it out and see what happens.
UseWebpackDevMiddleware() runs on aspnet-webpack which has not been updated to be compatible with Webpack 4. You'll want to hold off on using it until it gets updated.
Related
I have a CI/CD pipeline for an Angular project which yesterday worked fine, but today the same code is returning several errors on the build:
./src/styles.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./src/styles.scss
- Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js): SassError: Undefined variable.
╷ 142 │ values: $utilities-border-colors
│ ^^^^^^^^^^^^^^^^^^^^^^^^
╵ node_modules\bootstrap\scss\_utilities.scss 142:15 #import src\styles.scss 7:9 root stylesheet
./src/styles.scss - Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined variable.
╷
142 │ values: $utilities-border-colors
│ ^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules\bootstrap\scss\_utilities.scss 142:15 #import
src\styles.scss 7:9 root stylesheet
at tryRunOrWebpackError (C:\User\user\project\node_modules\webpack\lib\HookWebpackError.js:88:9)
at __webpack_require_module__ (C:\User\user\project\node_modules\webpack\lib\Compilation.js:4979:12)
at __webpack_require__ (C:\User\user\project\node_modules\webpack\lib\Compilation.js:4936:18)
at C:\User\user\project\node_modules\webpack\lib\Compilation.js:5007:20
at symbolIterator (C:\User\user\project\node_modules\neo-async\async.js:3485:9)
at done (C:\User\user\project\node_modules\neo-async\async.js:3527:9)
at Hook.eval [as callAsync] (eval at create (C:\User\user\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\User\user\project\node_modules\tapable\lib\Hook.js:18:14)
at C:\User\user\project\node_modules\webpack\lib\Compilation.js:4914:43
at symbolIterator (C:\User\user\project\node_modules\neo-async\async.js:3482:9)
at timesSync (C:\User\user\project\node_modules\neo-async\async.js:2297:7)
at Object.eachLimit (C:\User\user\project\node_modules\neo-async\async.js:3463:5)
at C:\User\user\project\node_modules\webpack\lib\Compilation.js:4879:16
at symbolIterator (C:\User\user\project\node_modules\neo-async\async.js:3485:9)
at timesSync (C:\User\user\project\node_modules\neo-async\async.js:2297:7)
at Object.eachLimit (C:\User\user\project\node_modules\neo-async\async.js:3463:5)
-- inner error --
Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined variable.
╷
142 │ values: $utilities-border-colors
│ ^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules\bootstrap\scss\_utilities.scss 142:15 #import
src\styles.scss 7:9 root stylesheet
at Object.<anonymous> (C:\User\user\project\node_modules\css-loader\dist\cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!C:\User\user\project\node_modules\postcss-loader\dist\cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!C:\User\user\project\node_modules\resolve-url-loader\index.js??ruleSet[1].rules[6].rules[1].use[0]!C:\User\user\project\node_modules\sass-loader\dist\cjs.js??ruleSet[1].rules[6].rules[1].use[1]!C:\User\user\project\src\styles.scss:1:7)
at C:\User\user\project\node_modules\webpack\lib\javascript\JavascriptModulesPlugin.js:432:11
at Hook.eval [as call] (eval at create (C:\User\user\project\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1)
at Hook.CALL_DELEGATE [as _call] (C:\User\user\project\node_modules\tapable\lib\Hook.js:14:14)
at C:\User\user\project\node_modules\webpack\lib\Compilation.js:4981:39
at tryRunOrWebpackError (C:\User\user\project\node_modules\webpack\lib\HookWebpackError.js:83:7)
at __webpack_require_module__ (C:\User\user\project\node_modules\webpack\lib\Compilation.js:4979:12)
at __webpack_require__ (C:\User\user\project\node_modules\webpack\lib\Compilation.js:4936:18)
at C:\User\user\project\node_modules\webpack\lib\Compilation.js:5007:20
at symbolIterator (C:\User\user\project\node_modules\neo-async\async.js:3485:9)
at done (C:\User\user\project\node_modules\neo-async\async.js:3527:9)
at Hook.eval [as callAsync] (eval at create (C:\User\user\project\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\User\user\project\node_modules\tapable\lib\Hook.js:18:14)
at C:\User\user\project\node_modules\webpack\lib\Compilation.js:4914:43
at symbolIterator (C:\User\user\project\node_modules\neo-async\async.js:3482:9)
at timesSync (C:\User\user\project\node_modules\neo-async\async.js:2297:7)
Generated code for C:\User\user\project\node_modules\css-loader\dist\cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[1]!C:\User\user\project\node_modules\postcss-loader\dist\cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0].use[2]!C:\User\user\project\node_modules\resolve-url-loader\index.js??ruleSet[1].rules[6].rules[1].use[0]!C:\User\user\project\node_modules\sass-loader\dist\cjs.js??ruleSet[1].rules[6].rules[1].use[1]!C:\User\user\project\src\styles.scss
1 | throw new Error("Module build failed (from ./node_modules/sass-loader/dist/cjs.js):\nSassError: Undefined variable.\n ╷\n142 │ values: $utilities-border-colors\n │ ^^^^^^^^^^^^^^^^^^^^^^^^\n ╵\n node_modules\\bootstrap\\scss\\_utilities.scss 142:15 #import\n src\\styles.scss 7:9 root stylesheet");
I could reproduce it in local when I deleted the package-lock.json and generated one new.
This is my package.json
{
"name": "app-name",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"dev": "ng serve --host 0.0.0.0 -c dev",
"debug": "ng serve --host 0.0.0.0 -c debug",
"serve:es5": "ng serve --configuration es5 --host 0.0.0.0",
"build:dev": "ng build --configuration=dev",
"build:preprod": "ng build --configuration=preprod",
"build:prod": "ng build --configuration=production",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular-architects/ddd": "^2.0.0",
"#angular/animations": "^13.2.2",
"#angular/cdk": "^13.2.2",
"#angular/common": "^13.2.2",
"#angular/compiler": "^13.2.2",
"#angular/core": "^13.2.2",
"#angular/forms": "^13.2.2",
"#angular/localize": "^13.2.2",
"#angular/material": "^13.2.2",
"#angular/material-moment-adapter": "^13.2.2",
"#angular/platform-browser": "^13.2.2",
"#angular/platform-browser-dynamic": "^13.2.2",
"#angular/router": "^13.2.2",
"#babel/runtime": "^7.16.0",
"#fortawesome/angular-fontawesome": "^0.10.0",
"#fortawesome/fontawesome-svg-core": "^1.3.0",
"#fortawesome/free-solid-svg-icons": "^6.0.0",
"#microsoft/applicationinsights-web": "^2.7.1",
"#ng-bootstrap/ng-bootstrap": "^12.0.0-beta.4",
"#ngrx/effects": "^13.0.2",
"#ngrx/store": "^13.0.2",
"#ngrx/store-devtools": "^13.0.2",
"#ngx-translate/core": "^10.0.2",
"#ngx-translate/http-loader": "^3.0.1",
"#popperjs/core": "^2.10.2",
"#types/bootstrap": "^5.1.6",
"#types/file-saver": "^2.0.3",
"#types/jquery": "^3.5.8",
"amplitude-js": "^8.17.0",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.7.0",
"chart.js": "^2.9.4",
"classlist.js": "^1.1.20150312",
"core-js": "^2.6.12",
"dropzone": "^6.0.0-beta.2",
"file-saver": "^2.0.5",
"font-awesome": "^4.7.0",
"intl-tel-input": "^17.0.13",
"jquery": "^3.6.0",
"moment": "^2.29.1",
"ng-lottie": "git+https://github.com/Jrbebel/ng-lottie.git",
"ng2-nouislider": "^1.8.3",
"ngx-papaparse": "^5.0.0",
"nouislider": "^12.0.0",
"npm": "^8.11.0",
"poeditor-ci": "^1.15.0",
"pretty-checkbox": "^3.0.3",
"rxjs": "^6.6.7",
"tslib": "^2.0.0",
"uuid": "^3.4.0",
"xlsx": "^0.17.4",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "~13.1.3",
"#angular-eslint/builder": "^12.0.0",
"#angular-eslint/eslint-plugin": "^12.0.0",
"#angular-eslint/eslint-plugin-template": "^12.0.0",
"#angular-eslint/schematics": "^13.1.0",
"#angular-eslint/template-parser": "^12.0.0",
"#angular/cli": "^13.2.3",
"#angular/compiler-cli": "^13.0.0",
"#angular/language-service": "^13.2.2",
"#types/chart.js": "^2.9.34",
"#types/node": "^12.20.45",
"#typescript-eslint/eslint-plugin": "4.28.2",
"#typescript-eslint/parser": "4.28.2",
"codelyzer": "^6.0.0",
"eslint": "^7.26.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"protractor": "^7.0.0",
"ts-node": "~7.0.0",
"tslint": "~6.1.0",
"typescript": "4.5.5"
}
}
I don't even use the $utilities-border-colors variables and aren't present in my code.
My node version is 16.16
My npm version is 8.14.0
Could be that I have to update any of the dependencies, and why if I didn't change anything, it just doesn't work now?
Thanks in advance.
As it's said in the comments by Krenom, removing the ^ from the Bootstrap import fixed the issue.
Thanks for the responses and all the info.
Bootstrap v5.2 introduced a new file called _maps.scss. You must add it to your main Sass file.
Load your bootstrap modules in this order:
#import "~bootstrap/scss/functions";
#import "~bootstrap/scss/variables";
#import "~bootstrap/scss/maps"; // **Newly added!**
#import "~bootstrap/scss/mixins";
#import "~bootstrap/scss/utilities";
#import "~bootstrap/scss/helpers";
#import "~bootstrap/scss/utilities/api";
The problem should be fixed now.
I'll be greedy and slap it as an answer so that it can be accepted and one is available for those that follow.
The dangers of using ^ style versioning. Any one of those things might have been installed as a slightly different version that now breaks something. Bootstrap, at a guess given the error message and a new version was pushed out yesterday according to npm. Start with that and lock it down to a specific version (maybe just 5.1.3 for now, so just remove the ^) and see if that builds again.
You are kind of right, it's a bit strange that it happened without changing anything.
The reason of that is that yesterday a commit
took place on the main branch of twbs/
bootstrap, the v5.2.0 update.
The easy way to revert the changes is to follow #krenom advice.
Additionally, if you mind to install the v5.2.0 update please make sure to be advised about the new Sass file _maps.scss that comes with several Sasss maps from _variables.scss.
You can read more here.
There is a new _map.scss in v5.2.0. Don't have the details regarding your Webpack build but you probably just need to #import "~bootstrap/scss/maps"; (that's where $utilities-border-colors is defined) before #import "~bootstrap/scss/utilities";.
You can try to remove your node_modules directory and package-lock.json file. Then npm install.
And check if the error still append.
As #krenom say, it coulb be highter boostrap version dowloaded during the build. You can remove the ^ before the version in your package.json and reinstall your node_modules.
You need to define other 'sass' modules for Boostrap.
If you define as below, the problem is solved.
// Bootstrap initializaton
#import '~bootstrap/scss/functions';
#import '~bootstrap/scss/variables';
#import '~bootstrap/scss/mixins';
#import "~bootstrap/scss/maps";
#import "~bootstrap/scss/utilities";
#import "~bootstrap/scss/helpers";
#import "~bootstrap/scss/utilities/api";
I am migrating an Angular 7.2.0 application to a new Linux server, and I am unable to get the ng build command to run. Here is the package.json:
{
"name": "<app name>",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#agm/core": "^1.0.0-beta.5",
"#angular/animations": "~7.2.0",
"#angular/common": "~7.2.0",
"#angular/compiler": "~7.2.0",
"#angular/core": "~7.2.0",
"#angular/forms": "~7.2.0",
"#angular/http": "^7.2.2",
"#angular/platform-browser": "~7.2.0",
"#angular/platform-browser-dynamic": "~7.2.0",
"#angular/router": "~7.2.0",
"#mdi/font": "^3.3.92",
"#ng-select/ng-select": "^2.15.3",
"angular-confirmation-popover": "^4.2.0",
"angular-resize-event": "^1.0.0",
"angular2-ladda": "^2.0.0",
"awesome-bootstrap-checkbox": "^1.0.1",
"bootstrap": "^4.2.1",
"core-js": "^2.5.4",
"datatables.net-bs4": "^1.10.19",
"dripicons": "^2.0.0",
"font-awesome": "^4.7.0",
"highcharts": "^7.0.3",
"highcharts-angular": "^2.4.0",
"linkifyjs": "^2.1.9",
"metismenujs": "^1.0.3",
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"ng-block-ui": "^2.1.1",
"ng2-daterangepicker": "^2.0.12",
"ng2-search-filter": "^0.5.1",
"ngx-bootstrap": "^3.3.0",
"ngx-mask": "^7.3.6",
"ngx-perfect-scrollbar": "^7.2.0",
"ngx-toastr": "^9.1.1",
"ngx-uploader": "^7.1.0",
"rxjs": "~6.3.3",
"simple-line-icons": "^2.4.1",
"spinkit": "^1.2.5",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.12.0",
"#angular/cli": "~7.2.3",
"#angular/compiler-cli": "~7.2.0",
"#angular/language-service": "~7.2.0",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"#types/lodash": "^4.14.122",
"#types/moment-timezone": "^0.5.10",
"#types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
}
}
Here is ng --version:
Angular CLI: 7.2.4
Node: 8.17.0
OS: linux x64
Angular: 7.2.16
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.12.4
#angular-devkit/build-angular 0.12.4
#angular-devkit/build-optimizer 0.12.4
#angular-devkit/build-webpack 0.12.4
#angular-devkit/core 7.2.4
#angular-devkit/schematics 7.2.4
#angular/cli 7.2.4
#ngtools/webpack 7.2.4
#schematics/angular 7.2.4
#schematics/update 0.12.4
rxjs 6.3.3
typescript 3.2.4
webpack 4.28.4
And here is the error from ng build:
Warning: 4 repetitive deprecation warnings omitted.
Date: 2022-05-25T15:12:59.684Z
Hash: c3e6d9d0970d51906cb6
Time: 10245ms
chunk {main} main.js, main.js.map (main) 626 bytes [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 93.2 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 2.2 MB [initial] [rendered]
ERROR in src/app/admin/probe/sensor-chart/sensor-chart-abstract.class.ts(260,51): error TS2345: Argument of type '{ point: Point; }' is not assignable to parameter of type 'string | SeriesClickEventObject'.
Type '{ point: Point; }' is missing the following properties from type 'SeriesClickEventObject': bubbles, cancelBubble, cancelable, composed, and 18 more.
src/app/admin/probe/sensor-chart/sensor-chart-abstract.class.ts(283,37): error TS2345: Argument of type '{ id: string; draggable: string; labels: any[]; labelOptions: { style: { cursor: string; }; verticalAlign: string; y: number; }; events: { click: (event: any) => void; }; }' is not assignable to parameter of type 'AnnotationsOptions'.
Types of property 'draggable' are incompatible.
Type 'string' is not assignable to type '"" | "y" | "x" | "xy"'.
src/app/admin/report/probe-selector/probe-selector.component.ts(45,22): error TS2345: Argument of type '{ _selected: boolean; }' is not assignable to parameter of type 'ListIterateeCustom<Probe, boolean>'.
Object literal may only specify known properties, and '_selected' does not exist in type '[string | number | symbol, any] | ListIterator<Probe, boolean> | PartialShallow<Probe>'.
src/app/app.component.ts(7,27): error TS2307: Cannot find module '../environments/environment'.
src/app/app.component.ts(29,22): error TS2322: Type '{ useUTC: boolean; }' is not assignable to type 'GlobalOptions'.
Object literal may only specify known properties, and 'useUTC' does not exist in type 'GlobalOptions'.
src/app/app.module.ts(23,27): error TS2307: Cannot find module '../environments/environment'.
src/main.ts(5,29): error TS2307: Cannot find module './environments/environment'.
This application has been built before (and no code changes since), so it appears that I am running into a Node/NPM/node-sass versioning issue.
I have tried Node 8, Node 12, and Node 16 with various versions of node-sass and sass.
What should I look at considering this type of Typescript error in order to build this Angular 7 project?
Thanks!
I feel like my Angular app is fully setup for deploying to Heroku, but for some reason it just hangs during the build process and never continues - eventually resulting in a Build Failed message, but no logs.
Here is an excerpt of the heroku logs --tail:
-----> Build
Detected both "build" and "heroku-postbuild" scripts
Running heroku-postbuild
> flux-admin#1.0.0 heroku-postbuild /tmp/build_d18bae1ef2310aacfb6851eddfeab6d1
> ng build --prod
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.
chunk {0} runtime-es2015.edb2fcf2778e7bf1d426.js (runtime) 1.45 kB [entry] [rendered]
chunk {0} runtime-es5.edb2fcf2778e7bf1d426.js (runtime) 1.45 kB [entry] [rendered]
chunk {1} main-es2015.b5ce220634282bd1233e.js (main) 1010 kB [initial] [rendered]
chunk {1} main-es5.b5ce220634282bd1233e.js (main) 1.08 MB [initial] [rendered]
chunk {2} polyfills-es2015.2987770fde9daa1d8a2e.js (polyfills) 36.4 kB [initial] [rendered]
chunk {3} polyfills-es5.df1101cc1e7b588877f8.js (polyfills-es5) 122 kB [initial] [rendered]
chunk {4} styles.c1cdb3f05888558b2d70.css (styles) 60.6 kB [initial] [rendered]
Date: 2019-11-23T15:43:44.636Z - Hash: 80ca71603894ea5db348 - Time: 114953ms
That is where it just hangs.
Here is my package.json file:
"name": "flux-admin",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "node server.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"heroku-prebuild": "",
"heroku-postbuild": "ng build --prod"
},
"private": true,
"dependencies": {
"#angular/animations": "~8.2.14",
"#angular/cdk": "~7.3.3",
"#angular/cli": "~8.3.19",
"#angular/common": "~8.2.14",
"#angular/compiler": "~8.2.14",
"#angular/compiler-cli": "^8.2.14",
"#angular-devkit/build-angular": "~0.803.19",
"#angular/core": "~8.2.14",
"#angular/forms": "~8.2.14",
"#angular/material": "^7.3.3",
"#angular/platform-browser": "~8.2.14",
"#angular/platform-browser-dynamic": "~8.2.14",
"#angular/router": "~8.2.14",
"core-js": "^2.5.4",
"path": "^0.12.7",
"rxjs": "~6.5.3",
"express": "^4.17.1",
"rxjs-compat": "^6.4.0",
"tslib": "^1.9.0",
"typescript": "~3.5.3",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular/cli": "~8.3.19",
"#angular/compiler-cli": "^8.2.14",
"#angular/language-service": "~8.2.14",
"#types/jasmine": "~2.8.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.1",
"enhanced-resolve": "^3.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.5.3"
},
"engines": {
"node": "11.10.0",
"npm": "6.13.1"
}
My server.js file is the following:
//Install express server
const express = require('express');
const path = require('path');
const app = express();
// Serve only the static files form the dist directory
app.use(express.static(__dirname + '/dist/flux-admin'));
app.get('/*', function(req,res) {
res.sendFile(path.join(__dirname+'/dist/flux-admin/index.html'));
});
// Start the app by listening on the default Heroku port
app.listen(process.env.PORT || 8080);
Just in case I also added a Procfile:
web: node server.js
When I try and run ng build --prod --aot locally - it does complete successfully, so it just seems to not go onto the next step in the heroku deployment process (which I believe would be the start script).
Anything obvious wrong with my setup?
UPDATE
After multiple attempts to try and get this deployed - I ended up degrading back to Angular 7, and it deployed with no problem!
I believe the issue must stem with the new way the ng build --prod --aot is run in Angular 8, but I am not at all sure why or what the cause is. So for now, I will just continue using Angular 7 and post a bug report.
I have a problem with my angular 2/cli project.
I have done an update of my npm packages but after that, when I'm using ng serve, I get theses errors :
Time: 12752ms
chunk {0} main.bundle.js, main.bundle.map (main) 45.3 kB {2} [initial] [rendered]
chunk {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 20.6 kB {3} [initial] [rendered]
chunk {2} vendor.bundle.js, vendor.bundle.map (vendor) 3.52 MB [initial] [rendered]
chunk {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
ERROR in AppModule is not an NgModule
ERROR in ./src/app/shared/guards/unauth-guard.ts
Module build failed: Error: /Users/nicolas/Desktop/Dilit/seller-app/src/app/shared/guards/unauth-guard.ts (16,8): Property 'take' does not exist on type 'AngularFireAuth'.)
at _checkDiagnostics (/Users/nicolas/Desktop/Dilit/seller-app/node_modules/#ngtools/webpack/src/loader.js:116:15)
at /Users/nicolas/Desktop/Dilit/seller-app/node_modules/#ngtools/webpack/src/loader.js:141:17
# ./src/app/app.module.ts 23:0-59
# ./src/app/index.ts
# ./src/main.ts
# multi main
ERROR in ./src/app/shared/guards/auth-guard.ts
Module build failed: Error: /Users/nicolas/Desktop/Dilit/seller-app/src/app/shared/guards/auth-guard.ts (17,8): Property 'take' does not exist on type 'AngularFireAuth'.)
at _checkDiagnostics (/Users/nicolas/Desktop/Dilit/seller-app/node_modules/#ngtools/webpack/src/loader.js:116:15)
at /Users/nicolas/Desktop/Dilit/seller-app/node_modules/#ngtools/webpack/src/loader.js:141:17
# ./src/app/app.module.ts 24:0-55
# ./src/app/index.ts
# ./src/main.ts
# multi main
ERROR in ./src/app/application/application.component.ts
Module not found: Error: Can't resolve 'application.frame.component.html' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application'
# ./src/app/application/application.component.ts 39:18-61
# ./src/app/app.module.ts
# ./src/app/index.ts
# ./src/main.ts
# multi main
ERROR in ./src/app/application/dashboard/dashboard.component.ts
Module not found: Error: Can't resolve 'dashboard.component.html' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/dashboard'
# ./src/app/application/dashboard/dashboard.component.ts 63:18-53
# ./src/app/app.module.ts
# ./src/app/index.ts
# ./src/main.ts
# multi main
ERROR in ./src/app/application/dashboard/dashboard.component.ts
Module not found: Error: Can't resolve 'dashboard.component.scss' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/dashboard'
# ./src/app/application/dashboard/dashboard.component.ts 64:17-52
# ./src/app/app.module.ts
# ./src/app/index.ts
# ./src/main.ts
# multi main
ERROR in ./src/app/application/campaign/campaign.component.ts
Module not found: Error: Can't resolve 'campaign.component.html' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/campaign'
# ./src/app/application/campaign/campaign.component.ts 81:18-52
# ./src/app/app.module.ts
# ./src/app/index.ts
# ./src/main.ts
# multi main
ERROR in ./src/app/application/campaign/campaign.component.ts
Module not found: Error: Can't resolve 'campaign.component.scss' in '/Users/nicolas/Desktop/Dilit/seller-app/src/app/application/campaign'
# ./src/app/application/campaign/campaign.component.ts 82:17-51
# ./src/app/app.module.ts
# ./src/app/index.ts
# ./src/main.ts
# multi main
webpack: bundle is now VALID.
Even if I return to my old package.json config, I can't build my project.
These is my package.json :
{
"name": "seller-app",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/common": "2.4.1",
"#angular/compiler": "2.4.1",
"#angular/core": "2.4.1",
"#angular/forms": "2.4.1",
"#angular/http": "2.4.1",
"#angular/platform-browser": "2.4.1",
"#angular/platform-browser-dynamic": "2.4.1",
"#angular/router": "3.4.1",
"#types/node": "^6.0.53",
"angularfire2": "^2.0.0-beta.7-pre",
"core-js": "^2.4.1",
"firebase": "^3.6.4",
"ng2-img-cropper": "^0.7.6",
"ng2-toastr": "^1.3.2",
"rxjs": "5.0.2",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.4"
},
"devDependencies": {
"#angular/compiler-cli": "2.4.1",
"#types/jasmine": "2.5.40",
"#types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.24",
"codelyzer": "~2.0.0-beta.4",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.7.0",
"karma": "1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.4.0",
"protractor": "4.0.14",
"ts-node": "2.0.0",
"tslint": "4.2.0",
"typescript": "~2.1.4",
"webdriver-manager": "11.1.0"
}
}
Thanks for your help
I got the same error when upgrading TypeScript to 2.1.4. The error exists when downgrading to TypeScript 2.1.1. The error disappears when downgrading to TypeScript 2.0.8.
I have an application built in Angular2 RC5. I started my app in Angular2-Beta2.0.0. I am trying to copy the application to another system to do further development. The primary system still works with no issue, but when I pull down the same code to my 2nd system I get this error every time I start my application. I cant find any mention of traceur anywhere in my project files. I dont know what this is. The app still works fine on my orig system.
zone.js:461 Unhandled Promise rejection: Error: XHR error (404 Not Found) loading http://localhost:4200/traceur
Anyone know what this is and how to fix it?
Whole Error
zone.js:463 Error: Uncaught (in promise): Error: Error: XHR error (404 Not Found) loading http://localhost:4200/traceur
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:4200/vendor/zone.js/dist/zone.js:769:30)
at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38)
at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:423:34)
Error loading http://localhost:4200/traceur
Error loading http://localhost:4200/vendor/#angular/platform-browser-dynamic/index.js as "#angular/platform-browser-dynamic" from http://localhost:4200/main.js
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:4200/vendor/zone.js/dist/zone.js:769:30)
at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38)
at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:423:34)
Error loading http://localhost:4200/traceur
Error loading http://localhost:4200/vendor/#angular/platform-browser-dynamic/index.js as "#angular/platform-browser-dynamic" from http://localhost:4200/main.js
at resolvePromise (http://localhost:4200/vendor/zone.js/dist/zone.js:538:32)
at resolvePromise (http://localhost:4200/vendor/zone.js/dist/zone.js:523:18)
at http://localhost:4200/vendor/zone.js/dist/zone.js:571:18
at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:356:38)
at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:256:48)
at drainMicroTaskQueue (http://localhost:4200/vendor/zone.js/dist/zone.js:474:36)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:426:22)consoleError # zone.js:463_loop_1 # zone.js:490drainMicroTaskQueue # zone.js:494ZoneTask.invoke # zone.js:426
package.json
{
"name": "prod-campus-081616",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"mongoService": "../Mongo/bin/mongod",
"StartElasticSearch": "/usr/local/bin/elasticsearch",
"StartKibana453": "/usr/local/kibana/bin/kibana",
"node-start": "node ./bin/www",
"angular-start": "ng serve --live-reload false",
"postinstall": "typings install",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/common": "^2.0.0-rc.5",
"#angular/compiler": "^2.0.0-rc.5",
"#angular/core": "^2.0.0-rc.5",
"#angular/forms": "0.3.0",
"#angular/http": "2.0.0-rc.5",
"#angular/platform-browser": "^2.0.0-rc.5",
"#angular/platform-browser-dynamic": "^2.0.0-rc.5",
"#angular/router": "3.0.0-rc.1",
"angular2-oauth2": "^1.3.10",
"aws-sdk": "^2.5.0",
"aws-sign": "^0.1.2",
"body-parser": "~1.15.1",
"cookie-parser": "~1.4.3",
"debug": "~2.2.0",
"es6-shim": "0.35.1",
"express": "~4.13.4",
"fs": "0.0.2",
"hbs": "~4.0.0",
"jsonwebtoken": "^7.1.9",
"moment": "^2.14.1",
"mongoosastic": "^4.0.2",
"mongoose": "^4.5.9",
"mongoose-unique-validator": "^1.0.2",
"morgan": "~1.7.0",
"multer": "^1.2.0",
"multer-s3": "^2.3.2",
"ng2-bootstrap": "^1.0.24",
"ng2-dropdown": "0.0.12",
"ng2-file-upload": "^1.0.3",
"password-hash": "^1.2.2",
"path": "^0.12.7",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"s3fs": "^2.4.8",
"serve-favicon": "~2.3.0",
"systemjs": "0.19.26",
"uuid": "^2.0.2",
"zone.js": "0.6.12"
},
"devDependencies": {
"angular-cli": "1.0.0-beta.10",
"codelyzer": "0.0.20",
"ember-cli-inject-live-reload": "1.4.0",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8",
"protractor": "3.3.0",
"ts-node": "0.5.5",
"tslint": "3.11.0",
"typescript": "1.8.10",
"typings": "1.3.1"
}
}
system-config.ts
"use strict";
// SystemJS configuration file, see links for more information
// https://github.com/systemjs/systemjs
// https://github.com/systemjs/systemjs/blob/master/docs/config-api.md
/***********************************************************************************************
* User Configuration.
**********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
'moment': 'vendor/moment/moment.js',
'angular2-oauth2': 'vendor/angular2-oauth2',
'aws-sdk': 'vendor/aws-sdk',
'aws-sign': 'vendor/aws-sign',
'fs': 'vendor/fs',
'ng2-bootstrap': 'vendor/ng2-bootstrap',
'ng2-file-upload': 'vendor/ng2-file-upload'
};
/** User packages configuration. */
const packages: any = {
'angular2-oauth2': 'config.js',
'aws-sdk': 'index.js',
'aws-sign': 'index.js',
'ng2-bootstrap': 'ng2-bootstrap.js',
'ng2-file-upload': 'ng2-file-upload.js'
};
////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
* Everything underneath this line is managed by the CLI.
**********************************************************************************************/
const barrels: string[] = [
// Angular specific barrels.
'#angular/core',
'#angular/common',
'#angular/compiler',
'#angular/forms',
'#angular/http',
'#angular/router',
'#angular/platform-browser',
'#angular/platform-browser-dynamic',
// Thirdparty barrels.
'rxjs',
// App specific barrels.
'app',
'app/shared',
'app/header',
'app/article',
'app/auth',
'app/community',
'app/device',
'app/error',
'app/message',
'app/physical-drive',
'app/profile',
'app/topic',
'app/dashboard',
'app/profile/profile-edit',
/** #cli-barrel */
];
const cliSystemConfigPackages: any = {};
barrels.forEach((barrelName: string) => {
cliSystemConfigPackages[barrelName] = { main: 'index' };
});
/** Type declaration for ambient System. */
declare var System: any;
// Apply the CLI SystemJS configuration.
System.config({
map: {
'#angular': 'vendor/#angular',
'rxjs': 'vendor/rxjs',
'main': 'main.js'
},
packages: cliSystemConfigPackages
});
// Apply the user's configuration.
System.config({ map, packages });
SHORT ANSWER
If you run into this and have a working version of of your app on another box, copy the node_modules folder from the working system to the one having the issue, delete the contents of your dist folder, and restart your app.
LONG ANSWER
After searching everywhere I decided that this had to be related to packages that have been updated between the RC versions of Angular2 (I started this app with Beta2) and something that must have been changed or removed with newer versions that was there previously. Basically it seems like something was installed previously that no longer is getting installed now.
Note:
System A has always been working
System B never worked
I copied my entire node_modules folder from System A to System B. Restarted Node and Angular2 and everything was working. So I examined this node_modules folder from System A in comparison to the one generated from System B by running an npm install after deleting the node_modules folder.
I noticed that platform-browser-dynamic has been seriously thinned out since I first installed it. (120 items on System A vs 66 items on System B)
My package.json file is identicle on both System A and B with this line:
"#angular/platform-browser-dynamic": "^2.0.0-rc.5",
As a first test I copied the entire folder from A to B.
Result:
Error changed, no longer complained about platform-browser-dynamic, now it said:
Error loading http://localhost:4200/traceur
Error loading http://localhost:4200/vendor/#angular/core/index.js as "#angular/core"
The same thing happened as I replaced Core, Compiler, Platform-browser and Common.
Once all of those folders had been replaced with the version from my other system, everything started working.
This is great, however I must say it makes me wonder how I will ever be able to deploy this app. I dont know how I could have caused this, (Welcome to suggestions), so I'm hoping this is an issue that gets resolved with the final release of Angular2.