如果我使用 livesync 运行 native 脚本,iOS 模拟器会失败,而 andriod 不会。
我使用 NativeScript cli create
命令创建了项目。这是一个 Angular2 项目。如果我运行,我可以在 iOS 模拟器中运行这个项目
tns 运行 ios --emulator
。 Android 也很好,但 livesync 以某种方式中断。我无法在网上找到任何具体的内容。
根据 github 上的一个线程,这个问题应该已经在最新版本 2.4.2
上得到修复。
shell.js: internal error
Error: EEXIST: file already exists, symlink '../loose-envify/cli.js' -> '/Users/user/Desktop/app-sample/platforms/ios/app-sample/app/tns_modules/babel-traverse/node_modules/invariant/node_modules/.bin/loose-envify'
at Error (native)
at Object.fs.symlinkSync (fs.js:1054:18)
at cpdirSyncRecursive (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:76:10)
at cpdirSyncRecursive (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
at cpdirSyncRecursive (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
at cpdirSyncRecursive (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
at cpdirSyncRecursive (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:73:7)
at /usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:183:9
at Array.forEach (native)
at Object._cp (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/cp.js:157:11)
at Object.cp (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/common.js:186:23)
at TnsModulesCopy.copyDependencyDir (/usr/local/lib/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:42:21)
at _loop_1 (/usr/local/lib/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:17:20)
at TnsModulesCopy.copyModules (/usr/local/lib/node_modules/nativescript/lib/tools/node-modules/node-modules-dest-copy.js:31:13)
at /usr/local/lib/node_modules/nativescript/lib/tools/node-modules/node-modules-builder.js:129:32
at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
最佳答案
根据 recent post in the thread here 中的 vchimev :
The issue here is that all
.bin
directories insidenode_modules
should be ignored and should not be copied toplatforms
folder.A temporary workaround is to remove them manually as follows:
find . -iname .bin | xargs rm -rfv
显然他们认为他们解决了整个问题,但实际上应该在本月发布的即将发布的 2.5.0 版本中得到解决。
上周我采用了不同的方法来修复我的问题,但如果这种方法可行,那就简单多了。
关于javascript - iOS 的 NativeScript livesync 在启动时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41437466/