nativescript-schematics: ng add command throwing error when adding to a bare-bones project
TLDR this happens when you run the command:
Failed to find generated component file /auto-generated.component.css. Please contact the @nativescript/schematics author.
Environment
package.json
"name": "sample-project-for-code-sharing",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~8.2.0",
"@angular/common": "~8.2.0",
"@angular/compiler": "~8.2.0",
"@angular/core": "~8.2.0",
"@angular/forms": "~8.2.0",
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"rxjs": "~6.5.2",
"tslib": "^1.10.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.802.1",
"@angular/cli": "~8.2.1",
"@angular/compiler-cli": "~8.2.0",
"@angular/language-service": "~8.2.0",
"@types/node": "~8.9.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
}
}
Describe the bug
ng add @nativescript/schematics
Skipping installation: Package already installed
Reading Project Settings
Project settings:
{
"root": "",
"sourceRoot": "src",
"mainName": "main",
"mainPath": "src/main.ts",
"prefix": "one-space",
"tsConfig": "tsconfig.app.json",
"entryModuleClassName": "AppModule",
"entryModuleImportPath": "./app/app.module",
"entryModuleName": "App",
"entryModulePath": "src/app/app.module.ts",
"entryComponentClassName": "AppComponent",
"entryComponentImportPath": "./app.component",
"entryComponentName": "App",
"entryComponentPath": "src/app/app.component.ts",
"indexAppRootTag": "one-space-root"
}
Adding @nativescript/schematics to angular.json
Adding {N} files
Adding App_Resources
Adding NativeScript specific exclusions to .gitignore
Adding NativeScript run scripts to package.json
Adding NativeScript Project ID to package.json
Modifying web tsconfig
Modifying tslint.json
Adding Sample Shared Component
Failed to find generated component file /auto-generated.component.css. Please contact the @nativescript/schematics author.
To Reproduce fork the project listed below then run:
npm i && ng add @nativescript/schematics
Expected behavior Schematic would add what is needed and not throw an error.
Sample project
This is a base project spun up with ng new and it still does not work – this is prior to running the ng add command. Feel free to fork it.
https://github.com/quincarter/code-sharing-sample
Additional context
Trying to spin up an initial code sharing project and getting that error above with the ng add @nativescript/schematics command.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 4
- Comments: 18 (2 by maintainers)
The problem in existing projects is scss styles. In your exisitng project change your styles from scss to css. First in
angular.jsonand then in your components.Eventually add schematics normally with:
ng add @nativescript/schematicsThough if you decide to use scss, you can create new project using;
ng new --collection=@nativescript/schematics your-app --shared --style=scss@vegaskev,
You can try it using the
nextversion of@nativescript/schematics-ng add @nativescript/schematics@next.I actually did just spin up a project with css and it worked. But i feel like this does not solve the issue if i want to use scss instead of css
I actually did try that with scss and with css and had the same issue both times