I have searched, but the results seem to refer to the old occurrence of this bug (this problem or something similar was also present in 2.5.0, but went away when I switched to 2.5.2).
The temporary editor files in Jetbrains based IDEs seem to confuse the livesync, so when I save a file while using tns run android --emulator I get errors like:
Unable to sync files. Error is: Multiple errors were thrown:
ENOENT: no such file or directory, stat '/scratch/platforms/android/src/main/assets/app/app.module.ts___jb_tmp___'
I believe the process they use for saving is something like:
Android (probably both)
"tns-android": {
"version": "3.0.0-rc.1"
}
tns createtns run android --emulatorapp/app.module.ts (or any other file really) file using webstorm (I'm currently using Webstorm 2017.1.1 on Ubuntu Linux 16.04)Really annoying! My workflow has almost come to standstill. Affects me with Ubuntu and IntelliJ. Please fix!
I got the same problem :-( It worked in older IntelliJ/NativeScript Versions for me.
Same for me here, LifeSync not usable with Intellij IDEA
Same here, with the 3.0.0 cli ! (Ubuntu/webstorm)
I'm having the same issue but you can workaround that by disabling "safe write" in Intellij:

(Tested in Webstorm)
@jbsouvestre @echap @straussCS @fvonberg @CanKattwinkel @daveware-nv
Can you reproduce the issue on macOS or Windows?
Since I have no WebStorm I simulate it with script:
sed s/Stegen/Unknown/g item.service.ts > item.service.ts____tmp___
rm -rf item.service.ts
mv item.service.ts____tmp___ item.service.ts
and can not reproduce on macOS Sierra.
@dtopuzov sorry only Ubuntu available. You could try with free version of IntelliJ/Webstorm
@dtopuzov Based on your script I've just added more pressure like this:
for i in {1..100}; do
sed s/Stegen/Unknown/g item.service.ts > item.service.ts____tmp___;
rm -rf item.service.ts;
mv item.service.ts____tmp___ item.service.ts;
done
and I can reproduce it this way. Will try to fix it now.
@jbsouvestre @echap @straussCS @fvonberg @CanKattwinkel @daveware-nv
We have a quick fix for this issue. The library we use for watching the directory to know when new files are created supports mechanism to handle cases like this where there are instantly created and then deleted files.
Can you give it a try and give feedback:
which tns # Result is like /usr/local/bin/tns
ls -la /usr/local/bin/tns # Result is like /usr/local/bin/tns -> ../lib/node_modules/nativescript/bin/tns
cd /usr/local/lib/node_modules/nativescript/lib/services/livesync
livesync-service.js file with your editor at line 109let watcher = choki.watch(pattern, { ignoreInitial: true, cwd: syncWorkingDirectory }).on("all", (event, filePath) => {
and add
awaitWriteFinish: { stabilityThreshold: 500, pollInterval: 100 }
to the options of the watch like this:
let watcher = choki.watch(pattern, { ignoreInitial: true, cwd: syncWorkingDirectory, awaitWriteFinish: { stabilityThreshold: 500, pollInterval: 100 } }).on("all", (event, filePath) => {
We're waiting for your feedback
Hey @yyosifov ,
Thanks for the quick answer.
I just confirmed that your fix works ! Thanks !
Hello, @yyosifov your fix works for me as well. Thanks.
@jbsouvestre @echap @straussCS @fvonberg @CanKattwinkel @daveware-nv
Fix is already available in master branch of the CLI, you can try it with:
npm un -g nativescript
npm cache clean
npm i -g nativescript@next
Most helpful comment
@jbsouvestre @echap @straussCS @fvonberg @CanKattwinkel @daveware-nv
We have a quick fix for this issue. The library we use for watching the directory to know when new files are created supports mechanism to handle cases like this where there are instantly created and then deleted files.
Can you give it a try and give feedback:
livesync-service.jsfile with your editor at line 109and add
to the options of the watch like this:
We're waiting for your feedback