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
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 <module-name>
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.
I had this same problem, solved it by disabling the babel cache by setting the environment variable BABEL_DISABLE_CACHE=1
in my Application settings.
You can read more about the babel cache here: https://babeljs.io/docs/usage/require/#environment-variables
The error appeared when i tried load babel/register.
Please check the Cache.js at (..\node_modules\babel\node_modules\babel-core\lib\api\register\Cache.js) to see if there is any babel cache path definition, e.g.
process.env.BABEL_CACHE_PATH || _path2["default"].join(_homeOrTmp2["default"], ".babel.json");
If you leverage this kind of variables, it's needed to have BABEL_CACHE_PATH app setting key and value of ./cache otherwise anything with babel wouldn't work on azure. Please refer to http://blog.syntaxc4.net/post/2012/07/26/accessing-app-settings-configured-in-microsoft-azure-web-sites-using-php-and-node-js.aspx in case you wanna know the details of accessing app settings in Azure web site using node.js.
Should you have any further concern, please feel free to let us know.
You change the store location of .babel.json
by BABEL_CACHE_PATH
I think its better than disable caching
BABEL_CACHE_PATH=any_writable_and_exist_dir/babel.cache.json