I wrote an after_prepare hook for my Cordova assembly, which removes the node_modules folder from the final assembly:
#!/usr/bin/env node
var foldersToRemove = ["platforms/android/assets/www/node_modules", "platforms/ios/www/node_modules"];
var fse = require('fs-extra');
var path = require('path');
var rootdir = process.argv[2];
foldersToRemove.forEach(function(folder) {
var rmFolder = path.join(rootdir, folder);
fse.remove(rmFolder, function(err) {
if (err) {
return console.error(err);
} else {
console.log(rootdir);
console.log("fse folder removed success!")
}
});
});
This works for me when I run cordova prepare android -din the CLI, but when switching to iOS it crashes with the following error:
env: node \ r: no such file or directory Hook error with error code 127:
I tried only the link to the ios platform folder and it gives the same error message.
source
share