-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field 'browser' doesn't contain a valid alias configuration #8036
Comments
What you are describing is expected behavior. To make it work there are several options:
Also, as an aside, |
Thanks clydin. This is unfortunate if it is to be considered a defect as I am unable to act on any of your suggestions without incurring significant work. At the end of the day I need to be able to alias a javascript path, which worked up to v1.2.6 Normally this would be solved by editing the alias field of the webpack config. #7287 Seems to be related. |
I am getting this error in the latest CLI, with rxjs 5.4.2..... Field 'browser' doesn't contain a valid alias configuration |
I am getting the issue @TylerDev6 mentioned... It seems that instead of looking into the /node_modules folder, it's searching within the src folder... This started happening after upgrading to angular v5, angular cli 1.5 and typescript 2.4.2 |
Angular 5 requires rxjs 5.5+. |
i started getting this error after i upgraded to angular 5 and angular cli 1.5.0 Angular CLI: 1.5.0 @angular/cli: 1.5.0 |
I had the exactly same error here. @angular/cli: 1.6.0 |
Also I was getting this error when html markup is invalid. Just make your html closing tag invalid, in my case I forgot to change closing main tag. <app-header></app-header>
<main role="main" class="container">
<router-outlet></router-outlet>
</div>
<app-footer></app-footer> Using |
Same error here, we rollback the npm update today to fix, working versions:
Bad versions (cause the related error browser):
Hope this help. |
Hi, tecnocat, |
Our problem was only the We fix with this commands:
And everything works great. |
I got this error when I hade my page modules declared in both
I would suggest running |
NOTE: Definitely commit to git before you run ngc as it adds a bunch of files you don't want added to your repo i.e.
|
A totally different problem here, we had some compiler errors (imports were incorrect, VSCode showed that nicely) in a lazy-loaded feature module. However, those went entirely undetected by I think what needs to be done here is a better surfacing of the underlying error, it appears the error message discussed in this issue masks all sorts of different underlying errors. |
The same issue, Angular 5 is not showing proper error message and many breaking changes :( |
I downgraded to ng 5.0.5 to be able to see the underlying errors(as suggested here). |
I think the error messages are not too good and say nothing about the issue itself, in my case I solved this issue in tsconfig, to my app config I added an alias in my config and this alias contains a path to a module file, and this path is relative so I need to make the following changes: Before:
After:
Just './' and AoT is working again. Hope it helps. |
Same error message here. |
Thanks @JosepAlacid, I had the same problem with |
@JosepAlacid and @aeslinger0, I too had this problem with auto-import in Visual Studio Code. This was fixed by changing... For anyone else who initially got lost in the error message like I did, everything you need is in the first two lines. The first line has the file the import was incorrectly auto-imported, and the second line is which path doesn't have the module you are trying to import. |
I was having this exact same error and couldn't figure it out. In our project I had refactored it a bit and created a This was the cause of the error that's discussed here. It said nothing about that being the issue but I walked through the Git history to figure out what might have caused this error and discovered two duplicate components. I'm guessing the only reason that the error message wasn't more clear in my case is that even though the files were restored to their original location they weren't included in that module. |
In my case the problem was, that I imported Router from the wrong package: I changed then it worked |
There seems to be problems with the way TypeScript imports Angular packages: |
Had the same issue with accidentally importing Fixed the import, no more error |
same issue as @jtlthe2 |
it works for me now. The issue was wrong import path for HttpClientModule VS code intellisence gives the following import import { HttpClientModule } from "@angular/common/http/src/module"; While, it should be import { HttpClientModule } from "@angular/common/http"; |
I'm now using Typescript version 2.7.0dev in VSCode. Pointing to that local version by configuring |
For me the same problem occurred when I generate files in one project with (css styles) and moved them to another with scss without renaming extension inside of ts file. The error is really tricky to follow and find the reason. |
My solution :I work on windows machine. So I checked and find that the messages is becuase in some places I used small\upper case that does NOT fit the files/folders. example - where actually - the file was in other camel case. |
See reported issues @ angular/angular-cli#8036
ionic app-scripts ^3.1.4 works for me. I was using 3.1.8 and this error occurred. Roll back to 3.1.4 and try it |
baseUrl in tsconfig only affects ts files, and the dist is built js files. This means when looking, webpack doesn't know where 'config' is. It needs '../config' See angular/angular-cli#8036 (comment) for the explaination
Hi Guys, I have recently upgraded my all packages along-with application on angular 7. After that few of my packages started failing complaining "Field 'browser' doesn't contain a valid alias configuration".
Before upgrade, everything was working fine. Below, I have pasted package.json. package.json {
"name": "@kognifai/poseidon-ng-datacontextselectorcomponent",
"version": "2.2.0-alpha.0",
"description": "Angular implementation of Poseidon data context selector component",
"author": "Kongsberg Digital",
"license": "SEE LICENSE IN LICENSE",
"main": "./dist/bundles/poseidon-ng-datacontextselectorcomponent.umd.js",
"types": "./dist/kognifai-poseidon-ng-datacontextselectorcomponent.d.ts",
"scripts": {
"build": "ng-packagr -p package.json && mkdir dist\\assets && copy /Y .\\src\\assets\\*.* dist\\assets\\",
"update": "copy /Y package.publish.json dist\\package.json",
"test": "ng test --watch=false",
"lint": "ng lint"
},
"keywords": [
"poseidon",
"data context selector component"
],
"dependencies": {
"@angular/animations": "^7.1.2",
"@angular/common": "^7.1.2",
"@angular/compiler": "^7.1.2",
"@angular/core": "^7.1.2",
"@angular/forms": "^7.1.2",
"@angular/http": "^7.1.2",
"@angular/platform-browser": "^7.1.2",
"@angular/platform-browser-dynamic": "^7.1.2",
"@angular/router": "^7.1.2",
"@kognifai/poseidon-datacontextservice": "^2.2.0-alpha.0",
"@kognifai/poseidon-dropdown-directive": "^2.2.0-alpha.0",
"@kognifai/poseidon-ng-datacontextservice": "^2.2.0-alpha.0",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.11.2",
"@angular/cli": "^7.1.2",
"@angular/compiler-cli": "^7.1.2",
"@angular/language-service": "^7.1.2",
"@kognifai/poseidon-script-version-bump": "^2.2.0-alpha.0",
"@kognifai/poseidon-tslint": "^2.2.0-alpha.0",
"@types/jasmine": "^3.3.0",
"@types/jasminewd2": "^2.0.6",
"@types/node": "^10.12.12",
"codelyzer": "^4.5.0",
"core-js": "^2.6.0",
"jasmine-core": "^3.3.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^3.1.3",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.4",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"ng-packagr": "^4.4.5",
"protractor": "^5.4.1",
"ts-node": "^7.0.1",
"tsickle": "^0.34.0",
"tslint": "^5.11.0",
"typescript": "~3.1.6"
},
"ngPackage": {
"lib": {
"entryFile": "public_api.ts",
"externals": {
"@kognifai/poseidon-datacontextservice": "DataContextService",
"@kognifai/poseidon-ng-datacontextservice": "DataContextNgService",
"@kognifai/poseidon-dropdown-directive": "DropdownDirective"
}
},
"deleteDestPath": false,
"whitelistedNonPeerDependencies": [
"."
]
}
} tsconfig.json
tsconfig.app.json
Kindly let me know, if there is anything needs to be changed from my side. Thanks, |
My solution was simply add alias to webpack config
|
@Juanperezc I don't have webpack config and now we can't eject as well. I just migrated my app on angular 7 and it suddenly started failing. I don't have any external dependency as well! |
@rahulsahay19 I have about the same error as you, except with my own scss files. And also it only do it when I run my unit tests (using jasmine). My app serves fine though. Didn't try it to build with prod config yet. |
So I have just found a fix for my problem, so you might want to check it too if it was similar to mine : in angular.json, I had to change the short styles path for the full one after |
This seems like an old issue and there are a lot of potential solutions above. Can we close as fixed in the latest CLI or I'm missing something? |
We cannot. This is still an issue with
In my case, it appears to be a missing style.css file, which it's never complained about until I upgraded. |
In my case this is what did the trick, I changed this part of my code (angular.json) to this
|
This issue seems to contain reports of a similar error on different situation from several different versions of Angular CLI. It doesn't include a lot of reproductions however, so it's very hard for us to pinpoint and fix the problem. If you're still experiencing this error today can you open a new issue with a reproduction please? Thank you. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The build fails when trying to perform a build involving a requirejs dependency which also requires other files.
In this case the following error appears:
Field 'browser' doesn't contain a valid alias configuration
The error does not occur if the required file dependency has no dependencies, and it appears to have been introduced after 1.2.6. This affects both jit & aot builds.
Bug Report or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.4.7
node: 8.5.0
os: darwin x64
@angular/animations: 4.4.5
@angular/common: 4.4.5
@angular/compiler: 4.4.5
@angular/core: 4.4.5
@angular/forms: 4.4.5
@angular/http: 4.4.5
@angular/platform-browser: 4.4.5
@angular/platform-browser-dynamic: 4.4.5
@angular/router: 4.4.5
@angular/cli: 1.4.7
@angular/compiler-cli: 4.4.5
@angular/language-service: 4.4.5
typescript: 2.3.4
Repro steps.
Example Repository
Using 1.2.6 of the cli will build correctly.
At this stage the project builds and runs as expected.
However if the required file has other dependencies they will not be resolved and the build breaks.
The log given by the failure.
log.txt
Desired functionality.
Nested modules should resolve correctly.
Mention any other details that might be useful.
The regression was introduced after 1.2.6.
The example repo was built with cli 1.4.7.
Related Issue Related Issue 7341
The text was updated successfully, but these errors were encountered: