I have a pre-developed angular project, i just ran npm i
to install its packages locally, then ng serve
to run the project, the project works well without problems but..
when i wanted to create a new component with ng g c new-component
i got this error:
core.resolve is not a function
TypeError: core.resolve is not a function
at NodeModulesEngineHost._resolvePackageJson (C:\myProject\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:22:21)
at NodeModulesEngineHost._resolveCollectionPath (C:\myProject\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:43:36)
at NodeModulesEngineHost.createCollectionDescription (C:\myProject\node_modules\@angular-devkit\schematics\tools\file-system-engine-host-base.js:105:27)
at SchematicEngine._createCollectionDescription (C:\myProject\node_modules\@angular-devkit\schematics\src\engine\engine.js:70:40)
at SchematicEngine.createCollection (C:\myProject\node_modules\@angular-devkit\schematics\src\engine\engine.js:63:43)
at Object.getCollection (C:\..myProject\node_modules\@angular\cli\utilities\schematics.js:39:31)
at Class.run (C:\myProject\node_modules\@angular\cli\tasks\schematic-get-options.js:11:41)
at Class.beforeRun (C:\myProject\node_modules\@angular\cli\commands\generate.js:101:31)
at C:\..myProject\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:138:24
I deleted node_modules
folder and re-run npm i
again, and still the same issue.
I also searched on the net i could not find any of ressources talking about this issue.
here is my local configuration with ng version
:
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.7.4
Node: 14.17.5
OS: win32 x64
Angular: 5.2.11
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.2.5
@angular/cli: 1.7.4
@angular/material: 9.2.4
@angular-devkit/architect: 0.1102.17
@angular-devkit/build-angular: 0.1102.17
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/build-webpack: 0.1102.17
@angular-devkit/core: 11.2.17
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0
package.json
{
..
..
"dependencies": {
"2": "^3.0.0",
"@agm/core": "1.0.0-beta.3",
"@agm/snazzy-info-window": "^1.0.0-beta.7",
"@akveo/ng2-completer": "^9.0.1",
"@angular/animations": "^5.2.0",
"@angular/cdk": "^5.2.5",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"@clampy-js/clampy": "^1.0.10",
"@ngrx/store": "^5.2.0",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^6.0.0",
"@ngxs/store": "^2.0.0",
"@syncfusion/ej2-angular-calendars": "^19.2.62",
"@syncfusion/ej2-angular-schedule": "^19.2.56",
"@tinymce/tinymce-angular": "^4.2.0",
"anchorme": "^2.1.2",
"angular-2-dropdown-multiselect": "^1.8.0",
"angular-bootstrap-md": "^5.2.3",
"angular-star-rating": "^4.0.0-beta.3",
"angular-svg-icon": "^5.1.1",
"angular-text-input-highlight": "^1.4.0",
"angular-tree-component": "^8.5.6",
"angular2-multiselect-dropdown": "^3.2.1",
"angular5-csv": "^0.2.10",
"angular5-data-table": "^1.0.3",
"angular5-toaster": "^1.0.2",
"auth0-js": "^9.16.2",
"chart.js": "^2.7.2",
"chartjs-plugin-datalabels": "^0.7.0",
"classlist.js": "^1.1.20150312",
"cldr-data": "^36.0.0",
"copy-webpack-plugin": "^4.4.1",
"core-js": "^2.4.1",
"css-star-rating": "^1.2.4",
"element-resize-detector": "^1.2.1",
"file-saver": "^2.0.5",
"font-awesome": "^4.7.0",
"french-badwords-list": "^1.0.5",
"google-profanity-words": "^1.0.0",
"hammerjs": "^2.0.8",
"lodash": "4.17.21",
"lodash-es": "4.17.21",
"moment": "^2.29.1",
"moment-timezone": "0.5.23",
"mydatepicker": "^2.6.3",
"ng-intercom": "^7.0.0-beta.1",
"ng-multiselect-dropdown": "^0.3.4",
"ng-recaptcha": "^3.0.5",
"ng2-archwizard": "^2.1.0",
"ng2-carouselamos": "^3.2.0",
"ng2-ckeditor": "1.1.9",
"ng2-completer": "^3.0.3",
"ng2-select2": "^1.0.0-beta.16",
"ng2-slim-loading-bar": "^4.0.0",
"ng2-smart-table": "^1.7.2",
"ng2-tel-input": "^1.0.16",
"ng2-tooltip-directive": "^2.1.5",
"ng4-geoautocomplete": "^0.1.0",
"ng5-masonry": "^1.0.7",
"ng5-validation": "^1.0.0",
"ngx-bootstrap": "^2.0.5",
"ngx-color-picker": "^8.1.0",
"ngx-contextmenu": "^4.2.0",
"ngx-drag-drop": "^2.0.0",
"ngx-file-drop": "2.0.5",
"ngx-image-cropper": "^1.4.1",
"ngx-infinite-scroll": "^0.8.3",
"ngx-lazy-load-images": "^1.3.1",
"ngx-loading": "^2.0.1",
"ngx-odinvt-emoji-mart": "0.0.5",
"ngx-pagination": "^3.2.0",
"ngx-permissions": "^4.1.0",
"ngx-quill": "^1.6.0",
"ngx-slick-carousel": "^0.4.1",
"ngx-socket-io": "^3.0.1",
"ngx-spinner": "2.0.0",
"ngx-textarea-autosize": "^2.0.3",
"ngx-youtube-player": "^0.1.0",
"node-sass": "^4.14.1",
"onesignal": "^0.1.2",
"primeicons": "^1.0.0",
"primeng": "^6.1.5",
"print-js": "^1.6.0",
"rxjs": "^5.5.6",
"rxjs-compat": "^6.6.7",
"slick-carousel": "^1.8.1",
"snazzy-info-window": "^1.1.1",
"socket.io-client": "^2.1.1",
"time-ago-pipe": "^1.3.2",
"ts-xlsx": "0.0.11",
"typescript": "~2.5.3",
"xlsx": "^0.16.6",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^11.1.1",
"@angular-eslint/eslint-plugin": "^1.0.0",
"@angular/cli": "~1.7.4",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@ngxs/devtools-plugin": "^3.6.2",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/lodash": "4.14.50",
"@types/node": "~6.0.60",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"agm-overlays": "^1.4.1",
"codelyzer": "^4.0.1",
"eslint": "^7.17.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"prettier": "^2.2.1",
"protractor": "^5.3.2",
"systemjs-plugin-json": "^0.3.0",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
..
..
}
CodePudding user response:
following @Batajus's response about compatibility, i could fix this problem with these steps:
- Delete
node_module
folder - Delete package-lock.json
- Run npm i
- finally
npm i -D @angular-devkit/[email protected]
(angular-devkit/core should be 0.3.2 for Angular V5)