Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build... "path must be a string" #6

Closed
gitito opened this issue Apr 29, 2017 · 5 comments
Closed

Cannot build... "path must be a string" #6

gitito opened this issue Apr 29, 2017 · 5 comments
Labels

Comments

@gitito
Copy link

gitito commented Apr 29, 2017

With phonegap 6.5.0 and ios 4.3.0, when I run "phonegap build ios", I always get this error: path must be a string

Thanks

@kelvinhokk
Copy link
Owner

hi gitito, i have not tested with phonegap before, only cordova. In fact, the node scripts I used, reply on a cordova context like:

var path = context.requireCordovaModule('path');

I will try to make it work with phonegap when i get the chance.

@kelvinhokk
Copy link
Owner

kelvinhokk commented Apr 30, 2017

hi gitito,

I wasn't able to reproduce the error on Node 7.9.0, PhoneGap 6.5 and iOS 4.3.0 (I tried using a fresh nvm install of Node 7.8.0 and Node 6.8.0 too). I am running Mac OS X 10.12.4. I have not tried running the plugin on Windows nor Linux. Could it be a OS problem?

I did this:

nvm install 7.9.0
nvm use 7.9.0
npm install -g phonegap@latest
phonegap create phonegap-hello --template hello-world
cd hello-world
...
[copy and mkdir the translations folder with the json files here]
...
phonegap plugin add  cordova-plugin-localization-strings --fetch
phonegap platform add ios@4.3.0
phonegap build ios -d

Basically I was able to build. The phonegap build logs show:

�[36m[phonegap]�[39m executing 'cordova build ios -d ' ...
No scripts found for hook "before_build".


No scripts found for hook "before_prepare".


Checking config.xml for saved platforms 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/kelvinho/work/phonegap-apps/phonegap-hello/platforms/ios/helloworld/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.

Wrote out iOS Bundle Identifier "com.phonegap.helloworld" and iOS Bundle Version "1.0.0" to /Users/kelvinho/work/phonegap-apps/phonegap-hello/platforms/ios/helloworld/helloworld-Info.plist


iOS Product Name has not changed (still "helloworld")

Updating icons at platforms/ios/helloworld/Images.xcassets/AppIcon.appiconset/

Updating splash screens at platforms/ios/helloworld/Images.xcassets/LaunchImage.launchimage/

Prepared iOS project successfully

Executing script found in plugin cordova-plugin-localization-strings for hook "after_prepare": plugins/cordova-plugin-localization-strings/scripts/create_ios_strings.js

Resolving module name for path => path

Resolving module name for q => q

Resolving module name for glob => glob


Resolving module name for q => q

Resolving module name for path => path

Resolving module name for glob => glob

new pbx project written with localization groups

...
[more build logs]
...

@fishkingsin
Copy link

I have same problem when using

node 4.4.7
npm 2.15.8

@fishkingsin
Copy link

fishkingsin commented May 16, 2017

node 4.4.7
filesystem works with file path(string) only

function writeStringFile(plistStringJsonObj, lang, fileName) {
    var lProjPath = getTargetIosDir() + "/Resources/" + lang + ".lproj";
    fs.ensureDir(lProjPath, function (err) {
        if (!err) {
            var stringToWrite = jsonToDotStrings(plistStringJsonObj);
            var buffer = iconv.encode(stringToWrite, 'utf16');
            var filePath = lProjPath + "/" + fileName;
            fs.open(lProjPath + "/" + fileName, 'w', function(err, fd) {
                if(err) throw err;
                fs.writeFileSync(filePath, buffer);
            });
        }
    });
}```

@kelvinhokk
Copy link
Owner

kelvinhokk commented May 17, 2017

Hi Fishkingsin,

Thanks for the feedback, I finally reproduced the error in a node 4.x.x environment (even 4.8.3).

I have tested again on several Node environments and found that the minimum requirement for this plugin is:

node 5.0.0
nom 3.3.6
cordova 6.0.0

Perhaps you can install nvm and change node environments and try the plugin again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants