nebular
nebular copied to clipboard
Could not read Angular module file: /src/null.ts (Standalone) or /src/[object Object].ts (ng modules)
Issue type
- [X] bug report
Issue description
Current behavior:
I'm not able to add @nebular/theme 13.0.0 to a fresh angular 17 project.
After the add I get the error message:
Could not read Angular module file: /src/null.ts (Standalone)
Could not read Angular module file: /src/[object Object].ts (Module)
The packages installing successfully, but the rest of the installation fails
Expected behavior: Adding @nebular/theme without error message
Steps to reproduce:
- Start a new project with ng new (Angular 17)
- Run ng add @nebular/theme
- Theme: default
- Use customizable scss theme: Y
- Browser animations for Nebular: Y
- error appears
Other information:
npm, node, OS, Browser
Node, npm: v20.9.0 and 10.2.5
OS: macOS Sonoma 14.2.1
Browser: Chrome
Angular, Nebular
"@angular/animations": "^17.1.0",
"@angular/cdk": "^17.1.0",
"@angular/common": "^17.1.0",
"@angular/compiler": "^17.1.0",
"@angular/core": "^17.1.0",
"@angular/forms": "^17.1.0",
"@angular/platform-browser": "^17.1.0",
"@angular/platform-browser-dynamic": "^17.1.0",
"@angular/router": "^17.1.0",
"@nebular/eva-icons": "13.0.0",
"@nebular/theme": "^13.0.0",
"eva-icons": "^1.1.3",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"
I got the same issue while adding nebular theme with a fresh angular 17 project, hope they fix it asap.
Doing this commudle/nebular@4959180 (#4) change fixed the issue for us
Angular 17, standalone (without app.modules.ts):
Got it to work with the manually installation: https://akveo.github.io/nebular/docs/guides/install-nebular#manually
And adding the modules in app.config.ts. Looks something like this:
import {
ApplicationConfig,
EnvironmentProviders,
importProvidersFrom
} from '@angular/core'
import { provideRouter } from '@angular/router'
/* other imports */
import { routes } from './app.routes'
import { NbEvaIconsModule } from '@nebular/eva-icons'
import { NbThemeModule } from '@nebular/theme'
const provideNebular = (): EnvironmentProviders[] => [
importProvidersFrom(NbThemeModule.forRoot({ name: 'cosmic' })),
importProvidersFrom(NbEvaIconsModule)
]
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
/* other providers */
...provideNebular()
]
}
In angular.json add the css from the theme you want:
"styles": [
"src/styles.scss",
"node_modules/@nebular/theme/styles/prebuilt/cosmic.css"
],
Any updates here?
Angular 17, standalone (without app.modules.ts):
Got it to work with the manually installation: https://akveo.github.io/nebular/docs/guides/install-nebular#manually
And adding the modules in app.config.ts. Looks something like this:
import { ApplicationConfig, EnvironmentProviders, importProvidersFrom } from '@angular/core' import { provideRouter } from '@angular/router' /* other imports */ import { routes } from './app.routes' import { NbEvaIconsModule } from '@nebular/eva-icons' import { NbThemeModule } from '@nebular/theme' const provideNebular = (): EnvironmentProviders[] => [ importProvidersFrom(NbThemeModule.forRoot({ name: 'cosmic' })), importProvidersFrom(NbEvaIconsModule) ] export const appConfig: ApplicationConfig = { providers: [ provideRouter(routes), /* other providers */ ...provideNebular() ] }In angular.json add the css from the theme you want:
"styles": [ "src/styles.scss", "node_modules/@nebular/theme/styles/prebuilt/cosmic.css" ],
I've tried, doesn't work for me :(
@luhoviy do you have a public repo? Maybe I can take a quick look at it.