0

I am using NodeJS version 18. I am trying to deploy my Angular app to Firebase and/or run it successfully on my local, but I am unable to do so. [link to package.json and source code] -> https://github.com/anshumankmr/jovian-genai-hackathon/blob/master/UI/package.json

I have tried a lot of things but I am unable to figure it out. For example, in my angular.json file, I tried this:

enter image description here

and this

enter image description here.

Then I tried running 'npm run build' I got the following error however.

Error: Module not found: Error: Can't resolve '/home/anshuman/Documents/repos/jovian-genai-hackathon/UI/zone.js' in '/home/anshuman/Documents/repos/jovian-genai-hackathon/UI'

I have seen these links, but they are asking to modify a file here called polyfills.ts which doesn't exist in my codebase. Angular2 Final Release - "Error: Angular requires Zone.js prolyfill"

And this describes the exact opposite of what my current problem is : Terminal error: Schema validation failed with the following errors: Data path "['polyfills']" should be array

Anshuman Kumar
  • 464
  • 1
  • 6
  • 20

1 Answers1

1

I cloned the repo and made some changes to make it works.

In the tsconfig.app.json add the line

"src/polyfills.ts"

in the files array.

In the angular.json file, transform the polyfills array to be a string:

"polyfills": "src/polyfills.ts"

Then create a file named polyfills.ts with the content:

import 'zone.js'

in the src folder.

You can now serve the application.

Angular14 doesn't seems to support the new schema, but I've not managed to find any article about it. If you want to benefit from all the new stuff I suggest you to update your project to the latest LTS (At the time of this answer, the version 15).

EDIT:

My tests were done using NodeJS version 18.16.0 and NPM 9.6.7

Jacopo Sciampi
  • 2,990
  • 1
  • 20
  • 44