native-run: RangeError [ERR_OUT_OF_RANGE]
Version:
native-run: 0.2.7
node: 10.16.0
Description:
Native-run fails when running both through ionic run ios
and when running native-run
directly. I’ve tried running ionic run ios
both with and without the --l
flag with same result. Tried running native-run ios --app "platforms/ios/build/device/App Admin.ipa" --device --connect --forward 8100:8100
with same result.
Command Output:
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 37. Received 38
at boundsError (internal/buffer.js:49:9)
at writeU_Int8 (internal/buffer.js:558:5)
at Buffer.writeUInt8 (internal/buffer.js:565:10)
at toCString (/Users/antongildebrand/.nvm/versions/node/v10.16.0/lib/node_modules/native-run/node_modules/node-ioslib/dist/client/afc.js:150:9)
at AFCClient.makeDirectory (/Users/antongildebrand/.nvm/versions/node/v10.16.0/lib/node_modules/native-run/node_modules/node-ioslib/dist/client/afc.js:84:19)
at AFCClient.uploadDirectory (/Users/antongildebrand/.nvm/versions/node/v10.16.0/lib/node_modules/native-run/node_modules/node-ioslib/dist/client/afc.js:89:20)
at uploadApp (/Users/antongildebrand/.nvm/versions/node/v10.16.0/lib/node_modules/native-run/dist/ios/utils/device.js:85:21)
at process._tickCallback (internal/process/next_tick.js:68:7)
Environment Info:
Ionic:
Ionic CLI : 5.2.1 (/Users/antongildebrand/.nvm/versions/node/v10.16.0/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.5.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : ios 5.0.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 8 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.7
System:
Android SDK Tools : 26.1.1 (/Users/antongildebrand/Library/android-sdk-macosx)
ios-deploy : 1.9.4
ios-sim : 8.0.1
NodeJS : v10.16.0 (/Users/antongildebrand/.nvm/versions/node/v10.16.0/bin/node)
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001
macOS version:
10.14.5
Xcode version:
10.2.1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 24 (3 by maintainers)
Any news on the issue?
We found out the error was caused by non-ascii characters in path names.
The
s
is some file path and please see the below result:If you want to know which path is, run this file in the directory under investigation:
Ref: https://stackoverflow.com/a/66083078
As stated by @cxcxcxcx, a temporary fix is to open
/node_modules/native-run/dist/ios/lib/client/afc.js
and around line 160 changeconst buf = Buffer.alloc(s.length + 1);
withconst buf = Buffer.alloc(Buffer.byteLength(s) + 1);
Of course this is not a real solution, it will happen again as you run
npm i
. But it works until native-run gets updated.Sigh, turns out that it’s in https://www.npmjs.com/package/node-ioslib , which is not open sourced.
In the generated afs.js, it’s clear that
var buf = Buffer.alloc(s.length + 1);
should be replaced byvar buf = Buffer.alloc(Buffer.byteLength(s) + 1);
Also, all the strings responded should be decoded with UTF-8, rather than String.fromCharCode(token)
I’m getting the same error. My output: