why babel stores .babel.json in USERPROFILE path

前端 未结 4 1488
小蘑菇
小蘑菇 2021-01-04 11:33

I\'m running a nodejs app on azure web apps and i\'m trying to integrate babel using npm in it. The problem is that babel is trying to acccess a file at

4条回答
  •  北海茫月
    2021-01-04 11:53

    I create a nodejs app from Azure Gallery "Node JS Empty Web app" and run the command npm install -g babel in Kudu. I tried to reproduct your issue, but failed that the babel is not trying to access the file .babel.json at %USERPROFILE%.

    On Azure, the npm global modules will be installed into the path "D:\local\AppData". When you restart the WebApp, the node global modules will be deleted.

    If you have to use the node global modules, you can configure a startup task for a node web role to install node modules when web role start up in Cloud Service. Please refer to https://azure.microsoft.com/en-us/documentation/articles/cloud-services-startup-tasks/.

    Normally, installed node modules by using npm install at the path "wwwroot" of Kudu Debug Console on Azure Web Apps.

    I tried to install the babel module at the path "wwwroot" and run the command node_module\.bin\babel, and write a file include the code require('babel') to run it successfully. It works fine.

    Best Regards.

提交回复
热议问题