0

I keep getting the error You seem to not be depending on "@angular/core" I have tried everything on the stackoverflow it says from using npm install, npm link to everything. Does anyone know how to solve the error? enter image description here

try installing @angular/core but gets this error

C:\xampp\htdocs\kindyportalBackend>npm install @angular/core
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-devkit/build-angular@16.2.0
npm ERR! Found: jest@26.6.3
npm ERR! node_modules/jest
npm ERR!   peer jest@">=26 <27" from ts-jest@26.5.6
npm ERR!   node_modules/ts-jest
npm ERR!     dev ts-jest@"^26.5.2" from the root project
npm ERR!   dev jest@"^26.6.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional jest@"^29.5.0" from @angular-devkit/build-angular@16.2.0
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR!   dev @angular-devkit/build-angular@"^16.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: jest@29.6.4
npm ERR! node_modules/jest
npm ERR!   peerOptional jest@"^29.5.0" from @angular-devkit/build-angular@16.2.0
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^16.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\hemlata.mahaur\AppData\Local\npm-cache\_logs\2023-08-30T23_17_40_449Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\hemlata.mahaur\AppData\Local\npm-cache\_logs\2023-08-30T23_17_40_449Z-debug-0.log

After using --force it works and I can install @angular/core. Now if I run ng serve I get this error

An unhandled exception occurred: error TS500: Error: ENOENT: no such file or directory, lstat 'C:/xampp/htdocs/kindyportalBackend/src/tsconfig.app.json'
    at Object.lstatSync (node:fs:1668:3)
    at NodeJSFileSystem.lstat (file:///C:/xampp/htdocs/kindyportalBackend/node_modules/@angular/compiler-cli/bundles/chunk-TBUSSXUA.js:341:16)
    at calcProjectFileAndBasePath (file:///C:/xampp/htdocs/kindyportalBackend/node_modules/@angular/compiler-cli/bundles/chunk-6SPHWESC.js:7650:29)
    at readConfiguration (file:///C:/xampp/htdocs/kindyportalBackend/node_modules/@angular/compiler-cli/bundles/chunk-6SPHWESC.js:7676:39)
    at readTsconfig (C:\xampp\htdocs\kindyportalBackend\node_modules\@angular-devkit\build-angular\src\utils\read-tsconfig.js:49:26)
    at async configureI18nBuild (C:\xampp\htdocs\kindyportalBackend\node_modules\@angular-devkit\build-angular\src\utils\i18n-options.js:125:22)
    at async generateI18nBrowserWebpackConfigFromContext (C:\xampp\htdocs\kindyportalBackend\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:66:36)
    at async setup (C:\xampp\htdocs\kindyportalBackend\node_modules\@angular-devkit\build-angular\src\builders\dev-server\webpack-server.js:96:34)

See "C:\Users\HEMLAT~1.MAH\AppData\Local\Temp\ng-1nlzeP\angular-errors.log" for further details.

what file is that and how can I install it? I copy pasted this file enter image description here

Is it the right file?

I am running this in backend project folder or do I need to run ng serve in front end project?

After adding that file I ran ng serve and gets this error

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
        - install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "url": false }

./node_modules/nodemailer/lib/fetch/index.js:6:13-28 - Error: Module not found: Error: Can't resolve 'zlib' in 'C:\xampp\htdocs\kindyportalBackend\node_modules\nodemailer\lib\fetch'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
        - install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "zlib": false }
user022yufjb
  • 157
  • 1
  • 3
  • 11
  • Do you have `@angular/core` installed in your angular project? Is it listed as a dependency in your `package.json` file? – Chris Barr Aug 30 '23 at 23:11
  • @ChrisBarr how can I set that up? – user022yufjb Aug 30 '23 at 23:16
  • you have you install that package by running `npm install @angular/core --save` – Chris Barr Aug 30 '23 at 23:18
  • @ChrisBarr Please check the updated post. I tried that – user022yufjb Aug 30 '23 at 23:19
  • try adding the `--force` flag as well, sometimes there are issues installing which this can get around – Chris Barr Aug 30 '23 at 23:19
  • @ChrisBarr yeah that worked however stuck after using ng serve now. updated the post. Please check – user022yufjb Aug 30 '23 at 23:25
  • The file it says is missing... is it actually missing? If so, how did you start this angular project? Normally all of this stuff should be taken care of for you when you start a new Angular project with `ng new` on the command line – Chris Barr Aug 30 '23 at 23:31
  • @ChrisBarr not sure, maybe somehow it got deleted. But I added the same from another project. However am I suppose to run ng serve in frontend project or backend project? – user022yufjb Aug 30 '23 at 23:33
  • 1
    `ng serve` runs an Angular application. Angular is a front end framework. Angular has a bit of a complex setup and file structure that must be correct, but normally it's not something you need to worry about since the `ng new` will do all of that for you. Right now it looks like you are just going to be fixing errors one at a time as you encounter them, but there seems to be a larger issue here of your project not being set up correctly – Chris Barr Aug 30 '23 at 23:39

0 Answers0