Reputation: 8787
Probably it is not specifically related to webpack/memory-fs, but I am getting the RangeError: Maximum call stack size exceeded
error (see below for a call stack).
I have found out, that __dirname
on Azure (webapp) returns \\100.78.172.13\volume-7-default\8f5ecde749dace2bb57a\4e07195f015b45ce8e9ba255dc901988\site\repository\Source\Website\Content\app\node_modules\webpack\node_modules\memory-fs\lib\normalize.js
in my situation, while process.cwd()
returns D:\home\site\repository\Source\Website\Content\app
.
Is anything can be done from my side to configure node js to return D:\...
instead of \\..
?
How to reproduce:
https://github.com/intellismiths/webapp1
repository.Sync
. It will take 10+ minutes to complete and it will show that the deployment was successful.WEBSITE_NODE_DEFAULT_VERSION
to 6.2.2
npm cache clean
node -v
. It should be v6.2.2
D:\home\site\respository\src\WebApp1
npm run build
npm run build
on your local machine - it should produce wwwroot/app.js
without errors.webpack.config.js
to include context: __dirname
to fix previous errors.npm run build
Update 1
I only tried to set 6.2.2 runtime after adding the second package.json, so the project structure is not the simplest possible. Maybe just setting node to 6.2.2 breaks the build.
Upvotes: 3
Views: 2354
Reputation: 955
I had the same issue. Fixed it with UPGRADING npm not DOWNGRADING.
Bug is fixed in the npm versions newer than 6.5.
https://github.com/aumanjoa/chronas-community/blob/master/package.json#L48
Upvotes: 1
Reputation: 3804
It's been fixed in master
and it's proposed to be included in v6.4.0
.
See: https://github.com/nodejs/node/issues/7175#issuecomment-239824532 and https://github.com/nodejs/node/pull/8070
Upvotes: 3
Reputation: 10824
After a long day of research, trial-and-error and various experimentation, I've found an acceptable workaround if you're not willing to downgrade to Node 5.*:
npm install -g webpack
).Just using 6.1.0 gets around the "maximum call stack size exceeded" error, but instead gave me a lot of resolve failures when running webpack from node_modules (using ./node_modules/.bin/webpack
). Installing webpack globally finally got me past that.
If I understand it correctly, this whole issue with __dirname
in Node >= 6.2 resolving to the UNC folder path instead of the mounted path is going to be fixed, there's an active discussion here.
Upvotes: 1
Reputation: 13918
I could reproduce your issue following your steps. I found the key point was setting the WEBSITE_NODE_DEFAULT_VERSION
to 6.2.2
. And I found the webpack task worked fine if the WEBSITE_NODE_DEFAULT_VERSION
was under 6
.
Please downgrade the setting WEBSITE_NODE_DEFAULT_VERSION
to the version under 6
e.g. 5.9.0
if your node.js modules do not need such high version.
And according the package.json
of angular2 athttps://github.com/angular/angular/blob/master/package.json, it seems that the angular2 repository requires the node.js version between 5.4
and 6
.
Additionally, the web application's root directory on Azure Web Apps is D:\home\site\wwwroot
. So if you want to build your frontend project on Azure Web Apps, you need to locate to D:\home\site\wwwroot\wwwroot\mobile-web-app
then run npm run build
.
Upvotes: 4
Reputation: 6145
I believe that your __dirname shows your persistant drive where the data is stored, while .cwd gives current directory from where node ran. This is because Azure runs from the Drive but files are stored at the persistent drive.
In your Gruntfile.js add
module.exports = function (grunt) {
grunt.file.setBase(__dirname);
// Code omitted
}
Refer: link
Upvotes: 0