ios - Mac OSX 上的 Cordova : issues with a network project folder (Windows)

标签 ios macos cordova networking directory

我有这样一个场景,我所有的 Cordova 项目都存储在 Windows 机器上。在 Windows 中,我使用 Android 平台,它可以正常工作。

对于 iOS 平台,我在 Mac OSX (High Sierra) 上工作,通过网络共享文件夹访问项目文件夹(在 Windows 中)(我需要避免项目文件/文件夹的重复)。在 Mac 中,我可以浏览访问已安装驱动器 (/Volumes/PROJECTS) 的 Windows 文件,我使用 Windows 上存在的授权用户帐户(“spacorum”,具有管理员权限)连接到该驱动器。

我可以从 Mac 终端创建一个新项目,它完美地存储在 Windows 共享文件夹中。然后,在进入新创建的项目文件夹后,我尝试添加 ios 平台,这个过程永远不会结束,它什么也没做,也没有在“/platforms”下创建“ios”文件夹。

这是我运行“cordova platform add ios -d”的输出:

No scripts found for hook "before_platform_add".
No version supplied. Retrieving version from config.xml...
Grabbing pinned version.
Using cordova-fetch for cordova-ios@~4.5.4
saving

我必须取消它,否则它会像这样卡住好几天。 但 Cordova 工作正常,我检查了它,因为如果我在本地文件夹(存储在 Mac OSX 上,而不是通过网络存储在 Windows 上)执行相同的步骤,该过程将按预期结束:

No scripts found for hook "before_platform_add".
No version supplied. Retrieving version from config.xml...
Grabbing pinned version.
Using cordova-fetch for cordova-ios@~4.5.4
saving
Running command: npm install cordova-ios@~4.5.4 --production --save
Command finished with error code 0: npm install,cordova-ios@~4.5.4,--production,--save
Removing "cordova-" prefix from cordova-ios
Adding ios project...
PlatformApi successfully found for platform ios
Creating Cordova project for the iOS platform:
    Path: platforms/ios
    Package: com.example.hello
    Name: Hello
Copying iOS template project to /Users/spacorum/Desktop/test projects/Hello/platforms/ios
iOS project created with cordova-ios@4.5.5
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
PlatformApi successfully found for platform ios
Generating platform-specific config.xml from defaults for iOS at /Users/spacorum/Desktop/test projects/Hello/platforms/ios/Hello/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
  mkdir platforms/ios/www/cordova-js-src
  copy  platforms/ios/platform_www/cordova-js-src/exec.js platforms/ios/www/cordova-js-src/exec.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/platform.js platforms/ios/www/cordova-js-src/platform.js (new file)
  mkdir platforms/ios/www/cordova-js-src/plugin
  mkdir platforms/ios/www/cordova-js-src/plugin/ios
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js platforms/ios/www/cordova-js-src/plugin/ios/console.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js platforms/ios/www/cordova-js-src/plugin/ios/logger.js (new file)
  copy  platforms/ios/platform_www/cordova.js platforms/ios/www/cordova.js (updated file)
  copy  www/index.html platforms/ios/www/index.html (updated file)
  copy  www/js/index.js platforms/ios/www/js/index.js (updated file)
Current launch storyboard undefined
Not changing launch storyboard setting in info plist.
Wrote out iOS Bundle Identifier "com.example.hello" and iOS Bundle Version "1.0.0" to /Users/spacorum/Desktop/test projects/Hello/platforms/ios/Hello/Hello-Info.plist
No need to update build settings for launch storyboard support.
iOS Product Name has not changed (still "Hello")
This app does not have icons defined
This app does not have splash screens defined
Updating launch storyboard images at platforms/ios/Hello/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
Installing plugin "cordova-plugin-whitelist" following successful platform add of ios
Found variables for "cordova-plugin-whitelist". Processing as cli_variables.
Installing "cordova-plugin-whitelist" for ios
Running command: "/Users/spacorum/Desktop/test projects/Hello/platforms/ios/cordova/version" 
Command finished with error code 0: /Users/spacorum/Desktop/test projects/Hello/platforms/ios/cordova/version 
Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-whitelist on ios platform only.
No scripts found for hook "before_plugin_install".
Install start for "cordova-plugin-whitelist" on ios.
Beginning processing of action stack for ios project...
Action stack processing complete.
Install complete for cordova-plugin-whitelist on ios.
Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-whitelist on ios platform only.
No scripts found for hook "after_plugin_install".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
Generating platform-specific config.xml from defaults for iOS at /Users/spacorum/Desktop/test projects/Hello/platforms/ios/Hello/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
  copy  platforms/ios/platform_www/cordova_plugins.js platforms/ios/www/cordova_plugins.js (updated file)
Current launch storyboard undefined
Not changing launch storyboard setting in info plist.
Wrote out iOS Bundle Identifier "com.example.hello" and iOS Bundle Version "1.0.0" to /Users/spacorum/Desktop/test projects/Hello/platforms/ios/Hello/Hello-Info.plist
No need to update build settings for launch storyboard support.
iOS Product Name has not changed (still "Hello")
This app does not have icons defined
This app does not have splash screens defined
Updating launch storyboard images at platforms/ios/Hello/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
No scripts found for hook "after_prepare".
Saving ios@4.5.5 into platforms.json
--save flag or autosave detected
Saving ios@~4.5.5 into config.xml file ...
adding ios to cordova.platforms array in package.json
No scripts found for hook "after_platform_add".

如果这是权限问题,我不知道如何解决。 Windows 共享文件夹具有完全访问权限,我以授权用户身份登录。另外,我能够创建该项目,但我怀疑如果我没有 Mac 的权限,我能否做到这一点,对吗?

注意:我注意到,如果我在 Mac 终端 (ls -la) 上列出从 Windows 共享的文件夹,每个文件夹都有“700”作为默认权限,并且我无法使用 chmod 更改它,没有任何变化。另一方面,我在 Mac 上拥有的本地项目文件夹的每个子文件夹都具有更多权限 (755),我可以毫无问题地使用 chmod 更改它。

不是重度 *nix 用户,所以任何帮助将不胜感激,我已经在这里呆了一个星期了。

最佳答案

启动命令时似乎出现问题:

npm install cordova-ios@~4.5.4 --production --save

在 Mac OSX 上从 Cordova 工作区(位于 Windows 共享文件夹中)使用调试标志启动它时的输出如下:

npm info it worked if it ends with ok
npm info using npm@6.3.0
npm info using node@v10.7.0
npm http fetch GET 304 https://registry.npmjs.org/cordova-ios 361ms (from cache)
npm timing stage:loadCurrentTree Completed in 3628ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 4ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 22ms
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 3624ms
npm timing stage:loadIdealTree Completed in 3720ms
npm timing stage:generateActionsToTake Completed in 572ms
npm timing audit compress Completed in 13ms
npm info audit Submitting payload of 1190bytes
npm timing audit submit Completed in 1095ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1092ms
npm timing audit body Completed in 2ms
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/package.json'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/.eslintignore'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/.eslintrc.yml'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/.gitattributes'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/.istanbul.yml'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/.ratignore'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/.travis.yml'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/appveyor.yml'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/component.json'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/CONTRIBUTING.md'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/LICENSE'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/NOTICE'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/README.md'
WARN tar EIO: i/o error, open '/Volumes/PROJECTS/Hello/node_modules/.staging/cordova-ios-5086fba7/RELEASENOTES.md'
⸨       ░░░░░░░░░░░⸩ ⠹ extract:cordova-ios: timing audit body Completed in 2ms

相反,在 Mac OSX 中的本地工作区上运行时的输出是好的:

npm info it worked if it ends with ok
npm info using npm@6.3.0
npm info using node@v10.7.0
npm http fetch GET 200 https://registry.npmjs.org/cordova-ios 75ms (from cache)
npm timing stage:loadCurrentTree Completed in 2096ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 3ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 259ms
npm http fetch GET 304 https://registry.npmjs.org/pegjs 1121ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 5389ms
npm timing stage:loadIdealTree Completed in 5740ms
npm timing stage:generateActionsToTake Completed in 47ms
npm timing audit compress Completed in 11ms
npm info audit Submitting payload of 1244bytes
npm timing audit submit Completed in 1115ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1114ms
npm timing audit body Completed in 2ms
npm timing action:extract Completed in 4074ms
npm info lifecycle cordova-ios@4.5.5~preuninstall: cordova-ios@4.5.5
npm info lifecycle cordova-ios@4.5.5~uninstall: cordova-ios@4.5.5
npm info lifecycle cordova-ios@4.5.5~postuninstall: cordova-ios@4.5.5
npm timing action:unbuild Completed in 22ms
npm timing action:remove Completed in 328ms
npm timing action:finalize Completed in 43ms
npm timing action:refresh-package-json Completed in 36ms
npm info lifecycle cordova-ios@4.5.5~preinstall: cordova-ios@4.5.5
npm timing action:preinstall Completed in 2ms
npm info linkStuff cordova-ios@4.5.5
npm timing action:build Completed in 8ms
npm info lifecycle cordova-ios@4.5.5~install: cordova-ios@4.5.5
npm timing action:install Completed in 3ms
npm info lifecycle cordova-ios@4.5.5~postinstall: cordova-ios@4.5.5
npm timing action:postinstall Completed in 3ms
npm timing stage:executeActions Completed in 5001ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm timing stage:runTopLevelLifecycles Completed in 12979ms
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle undefined~shrinkwrap: undefined
npm info lifecycle undefined~postshrinkwrap: undefined
npm WARN com.example.hello@1.0.0 No repository field.

+ cordova-ios@4.5.5
updated 1 package and audited 128 packages in 13.272s
found 0 vulnerabilities

npm timing npm Completed in 14794ms
npm info ok

至少我可以放弃网络问题,npm 和 cordova 也工作得很好。这似乎是 Windows 端的权限问题,位于项目“/node_modules/.staging/”子文件夹中。我看不出如何,因为父文件夹“/PROJECTS”下的每个子文件夹对所有人(管理员、登录用户和任何其他用户)都是可写的。

我试图在 Windows 中关闭“node_modules”子文件夹中的只读标志,但是一旦我重新打开对话框窗口,它就会再次启用。

我还尝试关闭 Windows 10 防火墙和 Defender,没有任何区别。


更新和修复:最后,一个解决方案。我在这里分享这个以防有人遇到相同的情况和问题。我在“/Users/myusername/.npm-cache/_logs/”下找到了一条日志,它为我指明了正确的方向:

Error: Unknown system error -102: Unknown system error -102, symlink '../nopt/bin/nopt.js' -> '/Volumes/PROJECTS/Hello/node_modules/cordova-ios/node_modules/ios-sim/node_modules/.bin/nopt'

我读到这可能与 OSX 系统在 npm 命令启动期间无法创建符号链接(symbolic link)(在 WINDOWS 中)有关。我用它来避免运行 npm 命令时的符号链接(symbolic link):

npm config set bin-links false

这成功了。现在,iOS 平台已经从 OSX 终端完美添加,使用远程存储在 WINDOWS 机器中的项目文件夹。

案件已破!

关于ios - Mac OSX 上的 Cordova : issues with a network project folder (Windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51656311/

相关文章:

ios - AVAudioPlayer 在 iPhone 6 和 6+ 中以非常低的音量播放声音

linux - 未使用的 pthread 互斥锁或条件变量分配哪些资源?

objective-c - Cocoa PDFKit 添加文本到 PDF

cordova - Cordova Gradle错误:找不到com.android.tools.build:gradle:3.0.1

ios - 替换 NSPredicate 中的变量

ios - Swift 中的 Facebook 登录管理器 "expression is ambiguous"错误

ios - SwiftUI : Segue navigation

ios - 如何让 Mac OS X 防火墙永久允许我的 iOS 应用程序?

javascript - 图像根据移动设备宽度适合 div,无需拉伸(stretch)

iOS 相当于 HTML/CSS 中的分层 div