Android snapshot build failing—permission denied?


I’m attempting to run a snapshot build on the default Angular app using these commands.

tns create PerfTest --ng
cd PerfTest
npm install --save-dev nativescript-dev-webpack
npm install
npm run start-android-bundle --uglify --snapshot

Unfortunately the build fails. Here’s the full log, and here’s are the chunks that might be the root problem.

Error: Cannot find suitable v8 version! Original error: /bin/sh: /var/folders/cn/nsbk1gdx1qx8j432ypn682080000gn/T/snapshot-tools/mksnapshot-tools/v8-v5.5.372.32/darwin-x64/mksnapshot-ia32: Permission denied
Exception in thread "main" File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.
File:/Users/tj/dev/play/PerfTesting/platforms/android/src/main/java/com/tns/ Class: com.tns.FragmentClass
        at org.nativescript.staticbindinggenerator.Generator.writeBindings(
        at org.nativescript.staticbindinggenerator.Main.main(

Anybody have an idea what might be up here?


First thing I tried was using chmod +x on all those mksnapshot tools that I was getting permission denied on, which seemed to get me further. But now I’m stuck on this one.

Snapshot generation failed with the following error:
Error: Cannot find suitable v8 version! Original error: Command failed: /var/folders/cn/nsbk1gdx1qx8j432ypn682080000gn/T/snapshot-tools/mksnapshot-tools/v8-v5.5.372.32/darwin-x64/mksnapshot-arm64 /Users/tj/dev/play/PerfTest/platforms/android/src/main/assets/app/_embedded_script_.js --startup_blob /Users/tj/dev/play/PerfTest/platforms/android/snapshot-build/build/snapshots/blobs/arm64-v8a/TNSSnapshot.blob --profile_deserialization

    at getV8Version.then.catch.error (/Users/tj/dev/play/PerfTest/node_modules/nativescript-dev-webpack/snapshot/android/project-snapshot-generator.js:254:15)
    at process._tickCallback (internal/process/next_tick.js:109:7)


rm -rf /var/folders/cn/nsbk1gdx1qx8j432ypn682080000gn/T/snapshot-tools/mksnapshot-tools solved my problem. Apparently I had bad permissions somehow on that folder, and by deleting it I forced the Android runtime to reinstall everything for me. Who knew?


If you run a tool in sudo mode, when it downloads component, it will give the binary/executable files the same permissions it has. So if you run sudo npm install and then look inside node_modules/.bin you’d see they have root permissions. Because mksnapshot tool is an executable, if you run it somehow in root mode, it will have root permissions, and if you run it with the current user, you’d have the current user’s permissions.