Skip to content

Commit ecfe620

Browse files
committed
fix: fix "Could not open file Library/Application Support/LiveSync/app/tns_modules/tns-core-modules/inspector_modules.js for writing" error on iOS device when hmr fails
NativeScript CLI zips all files from application except the files from tns-modules. When the runtime unzip the uploaded archive on device, it symlinks the tns_modules folder. When hmr fails, CLI transfers fallback files on device in order to apply the change. The `inspector_modules.js` file is part of these fallback files which is located in `tns_modules` folder. In this situation CLI tries to write the file inside /Library/Application Support/LiveSync/app/tns_modules which is symlinked to app's bundle folder. As CLI is not able to write directly to app's bundle folder, the above error is thrown.
1 parent 98b14da commit ecfe620

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/services/livesync/ios-livesync-service.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as temp from "temp";
33

44
import { IOSDeviceLiveSyncService } from "./ios-device-livesync-service";
55
import { PlatformLiveSyncServiceBase } from "./platform-livesync-service-base";
6-
import { APP_FOLDER_NAME, TNS_MODULES_FOLDER_NAME } from "../../constants";
6+
import { APP_FOLDER_NAME } from "../../constants";
77
import { performanceLog } from "../../common/decorators";
88

99
export class IOSLiveSyncService extends PlatformLiveSyncServiceBase implements IPlatformLiveSyncService {
@@ -34,8 +34,6 @@ export class IOSLiveSyncService extends PlatformLiveSyncServiceBase implements I
3434
this.$logger.trace("Creating zip file: " + tempZip);
3535
this.$fs.copyFile(path.join(path.dirname(projectFilesPath), `${APP_FOLDER_NAME}/*`), tempApp);
3636

37-
this.$fs.deleteDirectory(path.join(tempApp, TNS_MODULES_FOLDER_NAME));
38-
3937
await this.$fs.zipFiles(tempZip, this.$fs.enumerateFilesInDirectorySync(tempApp), (res) => {
4038
return path.join(APP_FOLDER_NAME, path.relative(tempApp, res));
4139
});

0 commit comments

Comments
 (0)