Mac OSX上的Cordova:网络项目文件夹(Windows)有问题

时间:2018-08-02 14:38:59

标签: ios macos cordova networking directory

在这种情况下,我所有的Cordova项目都存储在Windows计算机上。在Windows中,我使用的是Android平台,该平台可以正常工作。

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

在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用户不是沉重的用户,因此不胜感激,我已经在这里呆了一周。

1 个答案:

答案 0 :(得分:0)

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

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命令启动期间无法创建符号链接(在WINDOWS中)有关。在运行npm命令时,我用它来避免符号链接:

npm config set bin-links false

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

案例解决了!