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";
Related
I am using angular nx with nestjs. When project is cloned and run yarn command on it, it builds successfully but when even I install any package and compile the project. it throws the error:
**D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\utils\fileutils.js:44
return JSON.parse(stripJsonComments(content));
^
SyntaxError: Unexpected token } in JSON at position 562
at JSON.parse (<anonymous>)
at Object.parseJsonWithComments (D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\utils\fileutils.js:44:17)
at new TargetProjectLocator (D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\core\target-project-locator.js:22:46)
at buildExplicitTypeScriptDependencies (D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\core\project-graph\build-dependencies\explicit-project-dependencies.js:8:34)
at D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\core\project-graph\project-graph.js:60:41
at Array.forEach (<anonymous>)
at buildProjectGraph (D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\core\project-graph\project-graph.js:60:26)
at Object.createProjectGraph (D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\core\project-graph\project-graph.js:40:30)
at Object.<anonymous> (D:\projectNAme\nrwl\node_modules\#nrwl\workspace\src\command-line\run-one.js:16:46)
at Generator.next (<anonymous>)
[21:31:39] 'deployLocalAPI' errored after 820 ms
[21:31:39] Error: Command failed: cd nrwl && nx serve api
at checkExecSyncError (node:child_process:636:11)
at Object.execSync (node:child_process:672:15)
at Object.exec (D:\projectNAme\/gulpfile.babel.js:36:8)
at D:\projectNAme\_config\gulp\tasks\deploy\apps\api\/deployLocal.js:41:10
at deployLocalAPI (D:\projectNAme\node_modules\undertaker\lib\set-task.js:13:15)
at bound (node:domain:413:15)
at runBound (node:domain:424:12)
at asyncRunner (D:\projectNAme\node_modules\async-done\index.js:55:18)
at processTicksAndRejections (node:internal/process/task_queues:75:11)**
and following are the versions I am using:
"#angular-devkit/build-angular": "~0.1100.1",
"#angular/cli": "~11.0.0",
"#angular/compiler-cli": "^11.0.0",
"#angular/language-service": "^11.0.0",
"#nestjs/schematics": "^7.0.0",
"#nestjs/testing": "^7.0.0",
"#nrwl/cli": "11.0.2",
"#nrwl/cypress": "11.0.2",
"#nrwl/eslint-plugin-nx": "11.0.2",
"#nrwl/jest": "11.0.2",
"#nrwl/nest": "11.0.2",
"#nrwl/node": "11.0.2",
"#nrwl/tao": "11.0.2",
"#nrwl/workspace": "11.0.2",
"#types/jest": "26.0.8",
"#types/node": "12.12.38",
"#typescript-eslint/eslint-plugin": "4.3.0",
"#typescript-eslint/parser": "4.3.0",
"codelyzer": "^6.0.0",
"cypress": "^5.5.0",
"dotenv": "6.2.0",
"eslint": "7.10.0",
"eslint-config-prettier": "6.0.0",
"jest": "26.2.2",
"jest-preset-angular": "8.3.1",
"prettier": "2.1.2",
"ts-jest": "26.4.0",
"ts-node": "~7.0.0",
"tslint": "~6.0.0",
"typescript": "~4.0.3"
This problem occurs when we inadvertently forget a comma in the end of a JSON object inside a .json file in your project. Usually, it happens after an edit to tsconfig.json.
Because of that lonely and unnecessary comma, the JSON parser cannot "find" nor "understand" the closing braces, because it is waiting for another JSON property, therefore the error:
"Unexpected token } in JSON"
This is an example that should yield such error for tsconfig.json (e.g., in Angular 11 projects with VSCode):
"angularCompilerOptions": {
"strictTemplates": true,
"fullTemplateTypeCheck": true,<----- this last comma might be the culprit
},
Solution, check the integrity of the structure of your recently edited json files for lonely commas or lost braces. If it is indeed any lonely comma, just removing it and saving the file should be enough.
I can't run my angular app on amazon ec2. When I execute ng serve or ng serve -c stage with environment.stage.ts configuration, i'm getting errors as shown on the screenshot below. The error does not appear when run locally on my pc and project is compiled without errors.
The version of rxjs is 5.5.5.
Angular, angular-cli and node version also below.
ERROR in ./node_modules/#angular/router/esm5/router.js
Module not found: Error: Can't resolve 'rxjs/BehaviorSubject' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#angular/router/esm5'
ERROR in ./node_modules/#agm/core/services/google-maps-api-wrapper.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services'
ERROR in ./node_modules/#agm/core/services/managers/data-layer-manager.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services/managers'
ERROR in ./node_modules/#agm/core/services/managers/marker-manager.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services/managers'
ERROR in ./node_modules/#agm/core/services/managers/info-window-manager.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services/managers'
ERROR in ./node_modules/#agm/core/services/managers/polyline-manager.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services/managers'
ERROR in ./node_modules/#agm/core/services/managers/circle-manager.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services/managers'
ERROR in ./node_modules/#agm/core/services/managers/kml-layer-manager.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services/managers'
ERROR in ./node_modules/#agm/core/services/managers/polygon-manager.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#agm/core/services/managers'
ERROR in ./node_modules/#angular/core/esm5/core.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#angular/core/esm5'
ERROR in ./node_modules/#angular/http/esm5/http.js
Module not found: Error: Can't resolve 'rxjs/Observable' in '/home/ubuntu/b2s_dev/b2s_v2_web/node_modules/#angular/http/esm5'
ℹ 「wdm」: Failed to compile.
BR,
try to import rxjs only without observables
{
"scripts": {
"ng": "ng",
"start": "ng serve",
"start-stage": "ng serve --env=stage",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build:universal:prod": "ng build --prod && ng build --prod --app 1 --output-hashing=false && cpy ./server.js ./dist",
"serve:universal:prod": "npm run build:universal:prod && cd dist && node server",
"compile_#agm_core": "babel node_modules/#agm/core -d node_modules/#agm/core --presets es2015",
"postinstall": "npm run compile_#agm_core"
},
"private": true,
"dependencies": {
"#agm/core": "^1.0.0-beta.2",
"#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/platform-server": "^5.2.7",
"#angular/router": "^5.0.0",
"#nguniversal/express-engine": "^5.0.0-beta.6",
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"core-js": "^2.4.1",
"moment": "^2.20.1",
"ng2-nouislider": "^1.7.7",
"ngx-disqus": "^2.3.7",
"nouislider": "^10.1.0",
"rxjs": "^5.5.5",
"zone.js": "^0.8.14"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.7.3",
"#angular/cli": "^6.1.3",
"#angular/compiler-cli": "^5.0.0",
"#angular/language-service": "^5.0.0",
"#types/googlemaps": "^3.30.4",
"#types/jasmine": "~2.5.53",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"cpy-cli": "^1.0.1",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
Use this command to install rxjs compact that will install the latest version of rxjs that is compatible with the Angular version that you are using.
npm install --save rxjs-compat
I have a project that is built in angular 5. here is the package.json
{
"name": "ff-client",
"version": "0.2.0",
"license": "",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint --type-check",
"e2e": "ng e2e",
"xprecommit": "ng lint --type-check && ng test --single-run --code-coverage",
"xprepush": "ng build --prod",
"i18n": "ng xi18n --i18n-format xlf --output-path src/locale --locale en --progress",
"i18n-merge": "xliffmerge --profile xliffmerge.json",
"browserstack": "ng e2e --no-serve --config protractor.browserstack.conf.js",
"upgrade": "yarn upgrade-interactive --latest",
"build-en": "ng build --prod --e deploy --output-path=dist/en --i18nFile=src/locale/messages.en.xlf --i18nFormat=xlf --locale=en --base-href /en/",
"build-da": "ng build --prod --e deploy --output-path=dist/da --i18nFile=src/locale/messages.da.xlf --i18nFormat=xlf --locale=da --base-href /da/",
"build-fo": "ng build --prod --e deploy --output-path=dist/fo --i18nFile=src/locale/messages.fo.xlf --i18nFormat=xlf --locale=fo --base-href /fo/",
"build-root": "copy dist\\en\\web.config dist\\ && del dist\\en\\web.config && del dist\\da\\web.config && del dist\\fo\\web.config",
"build-prod": "npm run build-en && npm run build-da && npm run build-fo && npm run build-root"
},
"private": true,
"dependencies": {
"#angular/animations": "5.2.9",
"#angular/cdk": "^5.2.4",
"#angular/common": "5.2.9",
"#angular/compiler": "5.2.9",
"#angular/core": "5.2.9",
"#angular/flex-layout": "^5.0.0-beta.14",
"#angular/forms": "5.2.9",
"#angular/http": "5.2.9",
"#angular/material": "^5.2.4",
"#angular/platform-browser": "5.2.9",
"#angular/platform-browser-dynamic": "5.2.9",
"#angular/router": "5.2.9",
"#angular/service-worker": "5.2.9",
"#aspnet/signalr": "^1.0.0-rc1-update1",
"#auth0/angular-jwt": "^1.0.0-beta.9",
"#ngrx/effects": "^5.1.0",
"#ngrx/router-store": "^5.0.1",
"#ngrx/store": "^5.1.0",
"#ngrx/store-devtools": "^5.1.0",
"angular-in-memory-web-api": "^0.5.2",
"applicationinsights-js": "^1.0.15",
"core-js": "^2.5.3",
"hammerjs": "^2.0.8",
"moment": "^2.20.1",
"ng-recaptcha": "^3.0.3",
"ng2-file-upload": "^1.3.0",
"ngrx-store-logger": "^0.2.0",
"ngx-perfect-scrollbar": "^5.3.5",
"redux-beacon": "^1.2.1",
"rxjs": "^5.5.8",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular/cli": "1.7.4",
"#angular/compiler-cli": "5.2.9",
"#angular/language-service": "5.2.9",
"#types/jasmine": "~2.8.6",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~9.4.6",
"chai": "^4.1.2",
"codelyzer": "~4.1.0",
"cucumber": "^4.0.0",
"husky": "^0.14.3",
"jasmine-core": "~2.99.1",
"jasmine-marbles": "^0.2.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.4.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-teamcity-reporter": "^1.0.1",
"ngx-i18nsupport": "^0.12.0",
"protractor": "^5.3.0",
"protractor-cucumber-framework": "^4.2.0",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "2.6.2"
}
}
I have download npm and angular-cli.
after installing these, I did npm install to get the required modules. but when I do "ng serve" it shows an error.
ERROR in
node_modules/#angular/flex-layout/core/typings/observable-media/observa
ble-media.d.ts(1,22): error TS2305: Module
'"D:/Projects/FlexFunding/app-dk/Clie
nt/node_modules/rxjs/Rx"' has no exported member 'Subscribable'.
I know now it is angular 6 and rxjs has updated in this version. but how can I solve this issue without migrating this project from angular version 5 to 6. I just need to build and run the project.
i have tried replace rxjs folder under node modules from a running a project. but no luck.
Edit: I have uninstall current version and downgraded to version angular cli version 1.7.4 but the error is same.
ERROR in
node_modules/#angular/flex-layout/core/typings/observable-media/observa
ble-media.d.ts(1,22): error TS2305: Module
'"D:/Projects/FlexFunding/app-dk/Clie nt/node_modules/rxjs/Rx"' has no
exported member 'Subscribable'.
in package.json one of the dependency is
"#angular/flex-layout": "^5.0.0-beta.14"
for ^ of "^5.0.0-beta.14", npm installs the latest version of flex-layout and in the latest version felx-layout uses RxJS 6. But as the project is an Angular 5 project, it uses previous version of RxJs. So, flex-layout failed to import the required libraries because RxJs 6 is not there.
so, the solution that worked for me is to change package.json
"#angular/flex-layout": "5.0.0-beta.14"
then npm install
Try reinstall your application
npm i
If this doesn't work, try delete node_modules folder and reinstall.
I have the latest node.js 8.x and npm 5.6.0 installed. When trying to do a npm install, I constantly get the following error:
npm ERR! code E404
npm ERR! 404 Not Found: #angular/router#5.2.0
The module that fails is different every time I retry the installation, but most typically it's #angular/forms#5.2.0, #angular/animations#5.2.0 and #angular/platform-browser#5.2.0
I do have a working internet connection
I have run npm config set registry https://registry.npmjs.org/.
I deleted the node_modules folder
I have deleted the cache: npm cache clean --force
An npm search does find the module:
C:\windows\system32>npm search #angular/router
NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS
#angular/router | Angular -
the… | =angular | 2018-04-16 | 5.2.10 | angular router
What else can be wrong?
Here is the package.json for completeness:
{
"name": "App",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --env=scapp",
"build-local": "ng build --env=dev",
"build-nonevis": "ng build --env=nonevis",
"test": "ng test",
"lint": "ng lint",
"lint-fix": "ng lint --fix",
"e2e": "ng e2e"
},
"dependencies": {
"#angular/animations": "5.2.0",
"#angular/common": "^5.2.0",
"#angular/compiler": "^5.2.0",
"#angular/core": "^5.2.0",
"#angular/forms": "5.2.0",
"#angular/http": "5.2.0",
"#angular/platform-browser": "5.2.0",
"#angular/platform-browser-dynamic": "5.2.0",
"#angular/router": "5.2.0",
"#ngx-translate/core": "9.1.1",
"#ngx-translate/http-loader": "2.0.1",
"#types/arcgis-js-api": "^4.4.0",
"#types/node": "9.4.0",
"angular2-esri-loader": "^1.0.0",
"cerialize": "^0.1.18",
"chart.js": "2.7.1",
"core-js": "^2.5.1",
"esri-loader": "^1.1.0",
"fullcalendar": "3.7.0",
"intl": "^1.2.5",
"jquery": "3.2.1",
"moment": "2.18.1",
"nanoscroller": "0.8.7",
"ngx-perfect-scrollbar": "5.3.4",
"primeng": "5.2.0",
"quill": "1.1.8",
"rxjs": "5.5.2",
"web-animations-js": "2.3.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"#angular/cli": "^1.6.5",
"#angular/compiler-cli": "^5.2.0",
"#types/jasmine": "2.5.53",
"#types/jasminewd2": "2.0.2",
"#types/node": "6.0.60",
"codelyzer": "4.0.1",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.1",
"karma": "1.7.1",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-coverage-istanbul-reporter": "1.3.0",
"protractor": "5.1.2",
"ts-node": "3.2.0",
"tslint": "5.7.0",
"typescript": "2.4.2"
}
}
The problem was caused by a local file .npmrc which contained the line always-auth = true. Removing this line resolved the issue. I have no idea how a 404 error is related to authentication, but noticed that after I switched to a mirror registry, it suddenly reported E401 instead of E404 like the official registry.
In my case, such issue was resolved by adding #latest to the command.
npm install -g #angular/cli#latest
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.