x)- [X] bug report -> please search issues before submitting
- [ ] feature request
I am getting this error:
#Cannot GET /assets/i18n/en.json
I'm seeing issues with the CLI not serving up anything in my assets/ folder.
I have tried every solution in every article I've been able to find that even remotely matches this issue and I've decided that I need help.
@angular/cli: 1.0.1
node: 7.9.0
os: darwin 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.1
@angular/compiler-cli: 4.0.2
Set up your app directory structure as such:
|____src
| |____app
| |____assets
| | |____i18n
| | | |____en.json
Cannot GET /assets/i18n/en.json
"dependencies": {
"@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",
"@ng-idle/core": "2.0.0-beta.11",
"@ngx-translate/core": "6.0.1",
"@ngx-translate/http-loader": "0.0.3",
"angular2-moment": "1.3.3",
"angular2-text-mask": "8.0.0",
"angular2-uuid": "1.1.0",
"bootstrap": "3.3.7",
"bootstrap-sass": "3.3.7",
"core-js": "2.4.1",
"ngx-bootstrap": "1.6.6",
"rxjs": "5.1.0",
"text-mask-addons": "3.5.0",
"zone.js": "0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.1",
"@angular/compiler-cli": "4.0.2",
"@types/jasmine": "2.5.38",
"codelyzer": "2.0.0",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "1.4.1",
"karma-chrome-launcher": "2.0.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-coverage-istanbul-reporter": "0.2.0",
"protractor": "5.1.0",
"ts-node": "2.0.0",
"tslint": "4.5.0",
"typescript": "~2.2.0"
}
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';
export function createTranslateLoader(http: Http) {
return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
}
@NgModule({
imports: [
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [Http]
}
})
],
exports: [BrowserModule, HttpModule, TranslateModule]
})
export class AppModule { }
I have the same problem. My project works fine with Angular CLI 1.0.0-beta.24. When I upgrade Angular CLI to 1.0.1 , It can't get some of css , icons and en.json files.
@poonehmousavi Weird.. yeah I was also upgrading from a beta release (1.0.0-beta-16). I might give beta-24 a shot, but there's got to be something that I'm missing with this new release. I followed the conversion doc word-for-word.
On Mon, May 1, 2017 at 6:35 PM Justin notifications@github.com wrote:
@poonehmousavi https://github.com/poonehmousavi Weird.. yeah I was also
upgrading from a beta release (1.0.0-beta-16). I might give beta-24 a shot,
but there's got to be something that I'm missing with this new release. I
followed the conversion doc word-for-word.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/angular/angular-cli/issues/6122#issuecomment-298338893,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWRlVTVsm0glmn_swV0cZBR0-KC5i_dtks5r1eatgaJpZM4NMB1I
.My problem is solved. In the angularcli. Json it is the asset part. In that
part define yoir files incliding icons , style and any other things. I
hope your provlem will be solved too.
@poonehmousavi can you provide an example? For instance, I have the following in my .json file for the assets folder:
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": "assets"
}
]
@poonehmousavi @everyoneelse I don't see this defined anywhere, but it was a very simple (and very stupid) fix to make this work, updated the assets piece to include an array instead of just a string mapping...
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets"
]
}
]
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._
Most helpful comment
@poonehmousavi @everyoneelse I don't see this defined anywhere, but it was a very simple (and very stupid) fix to make this work, updated the assets piece to include an array instead of just a string mapping...