Reputation: 321
So i using angular version 8 in Termux Android ARM. This is the angular version information from Angular CLI:
$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.0.2
Node: 12.4.0
OS: android arm
Angular: <error>
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
But when i use ng add
command to add PWA and service worker for my website project, it returned to error:
$ ng add @angular/pwa --project betaleapofazzamgithubio
Workspace needs to be loaded before it is used.
Error: Workspace needs to be loaded before it is used.
at Workspace._assertLoaded (/data/data/com.termux/files/home/node_modules/@angular-devkit/core/src/experimental/workspace/workspace.js:108:19)
at Workspace.getProjectByPath (/data/data/com.termux/files/home/node_modules/@angular-devkit/core/src/experimental/workspace/workspace.js:156:14)
at getProjectByCwd (/data/data/com.termux/files/home/node_modules/@angular/cli/utilities/config.js:103:26)
at Object.getConfiguredPackageManager (/data/data/com.termux/files/home/node_modules/@angular/cli/utilities/config.js:116:25)
at Object.getPackageManager (/data/data/com.termux/files/home/node_modules/@angular/cli/utilities/package-manager.js:32:35)
at new AddCommand (/data/data/com.termux/files/home/node_modules/@angular/cli/commands/add-impl.js:25:49)
at Object.runCommand (/data/data/com.termux/files/home/node_modules/@angular/cli/models/command-runner.js:172:25)
at async default_1 (/data/data/com.termux/files/home/node_modules/@angular/cli/lib/cli/index.js:32:31)
Because the error, i using ng generate
command instead of ng add
command. But it's returned to error too. This is the error:
$ ng generate service-worker
Workspace needs to be loaded before it is used.
Error: Workspace needs to be loaded before it is used.
at Workspace._assertLoaded (/data/data/com.termux/files/home/node_modules/@angular-devkit/core/src/experimental/workspace/workspace.js:108:19)
at Workspace.getProjectByPath (/data/data/com.termux/files/home/node_modules/@angular-devkit/core/src/experimental/workspace/workspace.js:156:14)
at Object.getProjectByCwd (/data/data/com.termux/files/home/node_modules/@angular/cli/utilities/config.js:103:26)
at GenerateCommand.getDefaultSchematicCollection (/data/data/com.termux/files/home/node_modules/@angular/cli/models/schematic-command.js:251:38)
at GenerateCommand.parseSchematicInfo (/data/data/com.termux/files/home/node_modules/@angular/cli/commands/generate-impl.js:70:35)
at GenerateCommand.initialize (/data/data/com.termux/files/home/node_modules/@angular/cli/commands/generate-impl.js:16:54)
at GenerateCommand.validateAndRun (/data/data/com.termux/files/home/node_modules/@angular/cli/models/command.js:127:20)
at async Object.runCommand (/data/data/com.termux/files/home/node_modules/@angular/cli/models/command-runner.js:178:24)
at async default_1 (/data/data/com.termux/files/home/node_modules/@angular/cli/lib/cli/index.js:32:31)
Please the help for this error and fix this error solution.
Upvotes: 0
Views: 399
Reputation: 2189
npm install
ng generate component <componentName> //*for adding new component*
or ng generate service <serviceName> //*for adding new service*
Upvotes: 1