Reputation:
first i am in the correct directory
I tried to ng serve which worked eariler today but now I get the following errors:
Local workspace file ('angular.json') could not be found.
Error: Local workspace file ('angular.json') could not be found.
at WorkspaceLoader._getProjectWorkspaceFilePath (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/workspace-loader.js:37:19)
at WorkspaceLoader.loadWorkspace (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/workspace-loader.js:24:21)
at ServeCommand._loadWorkspaceAndArchitect (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/architect-command.js:180:32)
at ServeCommand.<anonymous> (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/architect-command.js:47:25)
at next (native)
at /home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/architect-command.js:7:71
at __awaiter (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/architect-command.js:3:12)
at ServeCommand.initialize (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/architect-command.js:46:16)
at Object.<anonymous> (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/models/command-runner.js:87:23)
at next (native)
then I ran ng update @angluar/cli --migrate-only --from 1.7.4
I did that by following the first answer from this stack overflow post: Error: Local workspace file ('angular.json') could not be found
the error from the update:
Error compiling schema, function code: var customRule0 = customRules[0]; var validate = async function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; var vErrors = null; var errors = 0; if (rootData === undefined) rootData = data; if ((data && typeof data === "object" && !Array.isArray(data))) { if (data.force === undefined) data.force = false ; if (data.all === undefined) data.all = false ; if (data.next === undefined) data.next = false ; if (data.migrateOnly === undefined) data.migrateOnly = false ; var errs__0 = errors;var valid1 = true; var data1 = data.packages; if ( data1 === undefined ) { valid1 = true; } else { var errs_1 = errors; if (Array.isArray(data1)) { var errs__1 = errors;var valid1; for (var i1 = 0; i1 < data1.length; i1++) { var errs_2 = errors; if (typeof data1[i1] !== "string") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.packages[' + i1 + ']' , schemaPath: '#/properties/packages/items/type' , params: { type: 'string' } , message: 'should be string' } ]); } var valid2 = errors === errs_2; if (!valid2) break; } } else { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.packages' , schemaPath: '#/properties/packages/type' , params: { type: 'array' } , message: 'should be array' } ]); } if (errors === errs_1) { customRule0.errors = null;var errs__1 = errors;var valid1; var customErrors1 = null; try { valid1 = await customRule0.call( self , data1 , (dataPath || '') + '.packages' , data , 'packages' , rootData ) ; } catch (e) { valid1 = false; if (e instanceof ValidationError) customErrors1 = e.errors; else throw e; } if (data) data1 = data['packages']; if ( !valid1) { if (Array.isArray(customErrors1)) { if (vErrors === null) vErrors = customErrors1; else vErrors = vErrors.concat(customErrors1); errors = vErrors.length; for (var i1=errs__1; i1<errors; i1++) { var ruleErr1 = vErrors[i1]; if (ruleErr1.dataPath === undefined) ruleErr1.dataPath = (dataPath || '') + '.packages'; ruleErr1.schemaPath = "#/properties/packages/$default"; } } else { throw new ValidationError([ { keyword: '$default' , dataPath: (dataPath || '') + '.packages' , schemaPath: '#/properties/packages/$default' , params: { keyword: '$default' } , message: 'should pass "$default" keyword validation' } ]); } } } var valid1 = errors === errs_1; } if (valid1) { var errs_1 = errors; if (typeof data.force !== "boolean") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.force' , schemaPath: '#/properties/force/type' , params: { type: 'boolean' } , message: 'should be boolean' } ]); } var valid1 = errors === errs_1; if (valid1) { var errs_1 = errors; if (typeof data.all !== "boolean") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.all' , schemaPath: '#/properties/all/type' , params: { type: 'boolean' } , message: 'should be boolean' } ]); } var valid1 = errors === errs_1; if (valid1) { var errs_1 = errors; if (typeof data.next !== "boolean") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.next' , schemaPath: '#/properties/next/type' , params: { type: 'boolean' } , message: 'should be boolean' } ]); } var valid1 = errors === errs_1; if (valid1) { var errs_1 = errors; if (typeof data.migrateOnly !== "boolean") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.migrateOnly' , schemaPath: '#/properties/migrateOnly/type' , params: { type: 'boolean' } , message: 'should be boolean' } ]); } var valid1 = errors === errs_1; if (valid1) { if ( data.from === undefined ) { valid1 = true; } else { var errs_1 = errors; if (typeof data.from !== "string") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.from' , schemaPath: '#/properties/from/type' , params: { type: 'string' } , message: 'should be string' } ]); } var valid1 = errors === errs_1; } if (valid1) { if ( data.to === undefined ) { valid1 = true; } else { var errs_1 = errors; if (typeof data.to !== "string") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.to' , schemaPath: '#/properties/to/type' , params: { type: 'string' } , message: 'should be string' } ]); } var valid1 = errors === errs_1; } if (valid1) { var data1 = data.registry; if ( data1 === undefined ) { valid1 = true; } else { var errs_1 = errors; if (typeof data1 !== "string") { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + '.registry' , schemaPath: '#/properties/registry/type' , params: { type: 'string' } , message: 'should be string' } ]); } var errs__1 = errors , prevValid1 = false , valid1 = false , passingSchemas1 = null; var errs_2 = errors; if (errors === errs_2) { if (typeof data1 === "string") { if (! formats.uri.test(data1) ) { var err = { keyword: 'format' , dataPath: (dataPath || '') + '.registry' , schemaPath: '#/properties/registry/oneOf/0/format' , params: { format: 'uri' } , message: 'should match format "uri"' } ; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } } var valid2 = errors === errs_2; if (valid2) { valid1 = prevValid1 = true; passingSchemas1 = 0; } var errs_2 = errors; if (errors === errs_2) { if (typeof data1 === "string") { if (! formats.hostname.test(data1) ) { var err = { keyword: 'format' , dataPath: (dataPath || '') + '.registry' , schemaPath: '#/properties/registry/oneOf/1/format' , params: { format: 'hostname' } , message: 'should match format "hostname"' } ; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } } var valid2 = errors === errs_2; if (valid2 && prevValid1) { valid1 = false; passingSchemas1 = [passingSchemas1, 1]; } else { if (valid2) { valid1 = prevValid1 = true; passingSchemas1 = 1; }}if (!valid1) { var err = { keyword: 'oneOf' , dataPath: (dataPath || '') + '.registry' , schemaPath: '#/properties/registry/oneOf' , params: { passingSchemas: passingSchemas1 } , message: 'should match exactly one schema in oneOf' } ; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; throw new ValidationError(vErrors); } else { errors = errs__1; if (vErrors !== null) { if (errs__1) vErrors.length = errs__1; else vErrors = null; } } var valid1 = errors === errs_1; } }}}}}}} } else { throw new ValidationError([ { keyword: 'type' , dataPath: (dataPath || '') + "" , schemaPath: '#/type' , params: { type: 'object' } , message: 'should be object' } ]); } if (errors === 0) return data; else throw new ValidationError(vErrors); }; return validate;
whats werid is I have no idea how to fix this.
update:
I deleted package-lock.json and then ran npm install then tried ng serve I then got the same error as before that my configuration has changed and that I have to run ng update.
ran ng update and got the same error as above.
attempted this fix:
npm install --save-dev @angular/[email protected]
ng update @angular/cli --migrate-only --from=1.7.4
then got this error:
/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:79
async run(environment) {
^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at module.exports (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/ember-cli/lib/cli/index.js:17:15)
at default_1 (/home/rickus/Documents/softwareProjects/211hospitality/suitsandtables/frontend/suitsandtables/node_modules/@angular/cli/lib/cli/index.js:37:12)
Upvotes: 2
Views: 4896
Reputation: 6365
When the asker says
first i am in the correct directory
... that was my issue.
You should be running ng test
in your angular directory.
If your project has several directories, make sure to go to the correct directory before running the tests.
Upvotes: 0
Reputation: 870
I had the same problem Would you try as follows :
npm install -g angular-universal-pwa@beta
ng new --collection angular-universal-pwa myAwesomeApp
cd myAwesomeApp
npm start
Upvotes: 0