Shubham Saini Thanks for posting your question in Microsoft Q&A. Based on the description above, it seems like you are developing Azure Function in the portal and would like to add package.json and dependent modules in the portal itself. Correct?
There are lot of Development limitations in the Azure portal as listed and other limitation on Linux Consumption plan is not possible to get into command line mode. With Dedicated or Premium plan, you can SSH into console mode and run npm command to install the modules referenced in package.json.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings?tabs=portal#platform-features

You can add directory in the File Share with Add Directory option in the portal and then add the needed files but not sure if this would help in your scenario. I am assuming you just want to do it for quick development/testing purposes.

I hope this helps and let us know if any questions.
--
If you found the answer to your question helpful, please take a moment to mark it as Yes for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.