You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the nativescript.id key in root package.json is removed, the tns prepare android fails with an arcane error message: sed: invalid replacement string.
I had to remove the nativescript.id so that I could change in iOS info.plist the application id (because we wanted to have a different id between Android an iOS).
When I did remove it, the tns prepare android was not working anymore failing with the error message above.
Steps to reproduce:
$ cd /tmp
$ tns create Sample
...
Project Sample was successfully created.
$ cd Sample
$ vi package.json
# Remove the nativescript.id key
$ cat package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"tns-android": {
"version": "2.5.0"
}
},
"dependencies": {
"nativescript-theme-core": "~1.0.2",
"tns-core-modules": "2.5.1"
},
"devDependencies": {
"babel-traverse": "6.23.1",
"babel-types": "6.23.0",
"babylon": "6.16.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*"
}
}
$ tns prepare android
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-dev-android-snapshot.js
Preparing project...
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
:config phase: createDefaultIncludeFiles
:config phase: copyAarDependencies
:config phase: addAarDependencies
+adding dependency: /private/tmp/Sample/platforms/android/libs/aar/widgets-release.aar
Incremental java compilation is an incubating feature.
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:clean
BUILD SUCCESSFUL
Total time: 17.151 secs
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
sed: invalid replacement string
...
This is caused by nativescript/lib/services/android-project-service.js:171:19 which is shell.sed('-i', /__PACKAGE__/, this.$projectData.projectId, manifestPath);. I guess it's failing because nativescript.id in package.json is now undefined.
$ tns prepare android --log trace
execFile: /usr/local/Cellar/android-sdk/24.4.1_1/platform-tools/adb "help"
execFile: /usr/local/Cellar/android-sdk/24.4.1_1/platform-tools/adb "help"
spawn: /usr/local/Cellar/android-sdk/24.4.1_1/platform-tools/adb "--help"
Socket {
connecting: false,
_hadError: false,
_handle:
Pipe {
bytesRead: 0,
_externalStream: {},
fd: 15,
writeQueueSize: 0,
owner: [Circular],
onread: [Function: onread],
reading: true },
_parent: null,
_host: null,
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: null,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: true,
domain: null,
_events:
{ end: { [Function: bound onceWrapper] listener: [Function: onend] },
finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
close: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
needDrain: false,
ending: false,
ended: false,
finished: false,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree:
CorkedRequest {
next: null,
entry: null,
finish: [Function: bound onCorkedFinish] } },
writable: false,
allowHalfOpen: false,
destroyed: false,
_bytesDispatched: 0,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: null,
_server: null }
Exec uname -a
stdout: Darwin hyena 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
stderr:
Exec npm -v
stdout: 4.1.2
stderr:
spawn: java "-version"
Exec node-gyp -v
stdout:
stderr: /bin/sh: node-gyp: command not found
Exec xcodebuild -version
stdout: Xcode 7.3.1
Build version 7D1014
stderr:
Exec gem which xcodeproj
stdout: /Users/mvachon/.rvm/gems/ruby-2.4.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb
stderr:
Exec pod --version
stdout: 1.2.0
stderr:
Exec '/usr/local/Cellar/android-sdk/24.4.1_1/platform-tools/adb' version
stdout: Android Debug Bridge version 1.0.36
Revision 0e9850346394-android
stderr:
spawn: /usr/local/Cellar/android-sdk/24.4.1_1/tools/android "-h"
Result when throw error is false:
{ stdout: '\n Usage:\n android [global options] action [action options]\n Global options:\n -s --silent : Silent mode, shows errors only.\n -v --verbose : Verbose mode, shows errors, warnings and all messages.\n --clear-cache: Clear the SDK Manager repository manifest cache.\n -h --help : Help on a specific command.\n\n Valid\n actions\n are\n composed\n of a verb\n and an\n optional\n direct\n object:\n- sdk : Displays the SDK Manager window.\n- avd : Displays the AVD Manager window.\n- list : Lists existing targets or virtual devices.\n- list avd : Lists existing Android Virtual Devices.\n- list target : Lists existing targets.\n- list device : Lists existing devices.\n- list sdk : Lists remote SDK repository.\n- create avd : Creates a new Android Virtual Device.\n- move avd : Moves or renames an Android Virtual Device.\n- delete avd : Deletes an Android Virtual Device.\n- update avd : Updates an Android Virtual Device to match the folders\n of a new SDK.\n- create project : Creates a new Android project.\n- update project : Updates an Android project (must already have an\n AndroidManifest.xml).\n- create test-project : Creates a new Android project for a test package.\n- update test-project : Updates the Android project for a test package (must\n already have an AndroidManifest.xml).\n- create lib-project : Creates a new Android library project.\n- update lib-project : Updates an Android library project (must already have\n an AndroidManifest.xml).\n- create uitest-project: Creates a new UI test project.\n- update adb : Updates adb to support the USB devices declared in the\n SDK add-ons.\n- update sdk : Updates the SDK by suggesting new platforms to install\n if available.\n',
stderr: '',
exitCode: 1 }
Exec mono --version
stdout:
stderr: /bin/sh: mono: command not found
Exec git --version
stdout: git version 2.11.1
stderr:
Exec gradle -v
stdout:
------------------------------------------------------------
Gradle 3.3
------------------------------------------------------------
Build time: 2017-01-03 15:31:04 UTC
Revision: 075893a3d0798c0c1f322899b41ceca82e4e134b
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_111 (Oracle Corporation 25.111-b14)
OS: Mac OS X 10.11.5 x86_64
stderr:
Exec "/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/javac" -version
stdout:
stderr: javac 1.8.0_111
System information:
{ procInfo: 'nativescript/2.5.0',
platform: 'darwin',
os: 'Darwin hyena 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64\n',
shell: '/bin/zsh',
dotNetVer: null,
procArch: 'x64',
nodeVer: 'v7.5.0',
npmVer: '4.1.2',
javaVer: '1.8.0',
nodeGypVer: null,
xcodeVer: 'Xcode 7.3.1\nBuild version 7D1014\n',
xcodeprojGemLocation: '/Users/mvachon/.rvm/gems/ruby-2.4.0/gems/xcodeproj-1.4.2/lib/xcodeproj.rb\n',
itunesInstalled: true,
cocoapodVer: '1.2.0',
adbVer: 'Android Debug Bridge version 1.0.36',
androidInstalled: true,
monoVer: null,
gitVer: '2.11.1',
gradleVer: '3.3',
javacVersion: '1.8.0_111' }
Looking for project in '/private/tmp/Sample'
Project directory is '/private/tmp/Sample'.
Validate options for platform: Android
Initializing analytics statuses.
Analytics statuses:
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'prepare'.
AnalyticsInstallationID: c42d21d4-e03a-4422-8c56-048940dbff74
monitor not started
monitor not started
monitor not started
monitor has started, connecting to http://5752dabccfc54c4ab82aea9626b7338e.monitor-eqatec.com/json.ashx
Analytics statuses:
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'NodeJSVersion' with value '7_5_0'.
Waiting for analytics to send information. Will check in a 1000ms.
Statistics was sent successfully (xhr).
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
Hooks directories: [ '/usr/local/lib/node_modules/nativescript/lib/hooks',
'/usr/local/lib/node_modules/nativescript/lib/common/hooks',
'/private/tmp/Sample/hooks' ]
BeforeHookName for command prepare is before-prepare
Executing before-prepare hook from /private/tmp/Sample/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook at location /private/tmp/Sample/hooks/before-prepare/nativescript-dev-android-snapshot.js in-process
Validating before-prepare arguments.
Hook completed
Preparing project...
Error: sed: invalid replacement string
at Object.error (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/common.js:76:27)
at Object._sed (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/sed.js:36:14)
at Object.sed (/usr/local/lib/node_modules/nativescript/node_modules/shelljs/src/common.js:338:25)
at /usr/local/lib/node_modules/nativescript/lib/services/android-project-service.js:171:19
at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
at /usr/local/lib/node_modules/nativescript/lib/services/platform-service.js:238:80
at Function.settle (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:249:26)
at FiberFuture.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:565:10)
at decorateMethod (/usr/local/lib/node_modules/nativescript/lib/common/helpers.js:253:36)
Analytics statuses:
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track feature 'CLI' with value 'help'.
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
List of registered commands: /?, appstore, appstore|upload, autocomplete, autocomplete|disable, autocomplete|enable, autocomplete|status, build, build|android, build|ios, clean-app, clean-app|android, clean-app|ios, create, debug, debug|android, debug|ios, deploy, dev-generate-help, dev-generate-messages, dev-post-install, dev-preuninstall, dev-test, dev-test|android, dev-test|ios, device, devices, device|android, device|get-file, device|ios, device|list-applications, device|list-files, device|log, device|put-file, device|run, device|stop, device|uninstall, doctor, emulate, emulate|android, emulate|ios, error-reporting, help, info, init, install, livesync, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|find, plugin|install, plugin|remove, plugin|search, plugin|update, post-install-cli, prepare, publish, publish|ios, run, run|android, run|ios, test, test|android, test|init, test|ios, update, usage-reporting
Reading help for command 'prepare'. FileName is 'prepare.md'.
# prepare
┌─────────┬──────────────────────────┐
│ Usage │ Synopsis │
│ General │ $ tns prepare <Platform> │
└─────────┴──────────────────────────┘
Copies common and relevant platform-specific content from the app directory to the subdirectory for the selected target platform
in the platforms directory. This lets you build the project with the SDK for the selected platform. You must specify the target platform for which you want to prepare your project.
### Attributes
<Platform> is the target mobile platform for which you want to prepare your project. You can set the following target platforms.
* android - Prepares your project for an Android build.
* ios - Prepares your project for an iOS build.
Analytics statuses:
{ TrackFeatureUsage: 0, TrackExceptions: 0 }
Trying to track exception with message 'sed: invalid replacement string'.
Waiting for analytics to send information. Will check in a 1000ms.
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
Statistics was sent successfully (xhr).
Waiting for analytics to send information. Will check in a 1000ms. Remaining time is: 29000
The text was updated successfully, but these errors were encountered:
I have similar issue, if I can set android/ios id separately that could be good.
Currently I have to set it manually when I need to test/publish different platform.
If the
nativescript.id
key in rootpackage.json
is removed, thetns prepare android
fails with an arcane error message:sed: invalid replacement string
.I had to remove the
nativescript.id
so that I could change in iOSinfo.plist
the application id (because we wanted to have a different id between Android an iOS).When I did remove it, the
tns prepare android
was not working anymore failing with the error message above.Steps to reproduce:
This is caused by
nativescript/lib/services/android-project-service.js:171:19
which isshell.sed('-i', /__PACKAGE__/, this.$projectData.projectId, manifestPath);
. I guess it's failing becausenativescript.id
inpackage.json
is now undefined.See #2367 (comment) for other details.
P.S. A trace log of the error:
The text was updated successfully, but these errors were encountered: