admin管理员组文章数量:1401499
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] -> .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:
and this
.
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
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./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:
and this
.
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
Share Improve this question edited Jun 28, 2023 at 6:10 Anshuman Kumar asked Jun 28, 2023 at 4:31 Anshuman KumarAnshuman Kumar 5771 gold badge8 silver badges28 bronze badges 4- Angular 14 isn't patible with Node18: more details here – Jacopo Sciampi Commented Jun 28, 2023 at 7:52
- The guy who helped me develop this told me he was using Node 18 :| Will try with a lower version of node... thanks @JacopoSciampi – Anshuman Kumar Commented Jun 28, 2023 at 8:23
- Getting the same error @JacopoSciampi. I used nvm to switch 14.15 version – Anshuman Kumar Commented Jun 29, 2023 at 4:08
- >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' – Anshuman Kumar Commented Jun 29, 2023 at 4:09
1 Answer
Reset to default 8I 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
本文标签:
版权声明:本文标题:javascript - How can I fix the following error: Data path "polyfills" must be string in my angular project? - 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744239735a2596730.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论