Skip to content
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

Could not read Angular module file: /src/null.ts (Standalone) or /src/[object Object].ts (ng modules) #3239

Open
1 task done
kisimediaDE opened this issue Jan 30, 2024 · 6 comments

Comments

@kisimediaDE
Copy link

kisimediaDE commented Jan 30, 2024

Issue type

  • 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"
@kisimediaDE kisimediaDE changed the title Could not read Angular module file: /src/null.ts Could not read Angular module file: /src/null.ts (Standalone) or /src/[object Object].ts (ng modules) Jan 30, 2024
@abdisamadm4
Copy link

I got the same issue while adding nebular theme with a fresh angular 17 project, hope they fix it asap.

@Ashwin-op
Copy link

Doing this commudle/nebular@4959180 (#4) change fixed the issue for us

@Raemy92
Copy link

Raemy92 commented Apr 14, 2024

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"
],

@luhoviy
Copy link

luhoviy commented Apr 18, 2024

Any updates here?

@luhoviy
Copy link

luhoviy commented Apr 18, 2024

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 :(

@Raemy92
Copy link

Raemy92 commented Apr 19, 2024

@luhoviy do you have a public repo? Maybe I can take a quick look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants