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

tns build errors: The value "false" is invalid for option "readableHighWaterMark" when CLI is installed with yarn #4103

Closed
lucasyvas opened this issue Nov 6, 2018 · 4 comments
Assignees
Labels

Comments

@lucasyvas
Copy link

lucasyvas commented Nov 6, 2018

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

$ tns info
✔ Getting NativeScript components versions information...
✔ Component nativescript has 5.0.0 version and is up to date.
✔ Component tns-core-modules has 5.0.1 version and is up to date.
✔ Component tns-android has 5.0.0 version and is up to date.
✔ Component tns-ios has 5.0.0 version and is up to date.

Describe the bug
The issue would appear to be triggered at build. The CLI fails with a rather low-level looking error:

$ tns build android --bundle --log trace
Loading extensions.
System information:
{ platform: 'linux',
  shell: '/bin/bash',
  os:
   'Linux watchtower 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux\n',
  procArch: 'x64',
  nodeVer: '10.13.0',
  npmVer: '6.4.1',
  nodeGypVer: null,
  nativeScriptCliVersion: '5.0.0',
  gitVer: '2.17.1',
  dotNetVer: null,
  javacVersion: '10.0.2',
  adbVer: '1.0.40',
  androidInstalled: true,
  monoVer: null,
  gradleVer: null,
  isAndroidSdkConfiguredCorrectly: true,
  xcodeVer: undefined,
  xcodeprojLocation: null,
  itunesInstalled: false,
  cocoaPodsVer: undefined,
  isCocoaPodsWorkingCorrectly: false,
  isCocoaPodsUpdateRequired: false,
  pythonInfo: null }
Looking for project in '/home/lucas/git/gitlab/nativescript'
Project directory is '/home/lucas/git/gitlab/nativescript'.
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
Your ANDROID_HOME environment variable is set and points to correct directory.
Your adb from the Android SDK is correctly installed.
The Android SDK is installed.
A compatible Android SDK for compilation is found.
Javac is installed and is configured properly.
The Java Development Kit (JDK) is installed and is configured properly.
Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
Installed Android Targets are:  [ 'android-28' ]
Directories found in /home/lucas/android-sdk/build-tools are 28.0.3
Versions found in /home/lucas/android-sdk/build-tools are 28.0.3
Selected version is:  28.0.3
Selected targetSdk is: 28
Validate options for platform: Android
Creating NativeScript project for the android platform
Path: /home/lucas/git/gitlab/nativescript/platforms/android
Package: org.nativescript.application
Name: nativescript
Copying template files...
⠋ Calling pacoteService.extractPackage for packageName: 'tns-android@5.0.0', destinationDir: '/tmp/runtimeDir118106-4785-tusefe.h16d' and options: undefined
⠹ Exec npm config get cache 
 stdout: /home/lucas/.npm
 
 stderr: 
Calling pacoteService.extractPackage for packageName: 'tns-android@5.0.0', destinationDir: '/tmp/runtimeDir118106-4785-tusefe.h16d' and options: undefined
Creating extract tar stream with options: {
  "strip": 1,
  "C": "/tmp/runtimeDir118106-4785-tusefe.h16d"
}
⠏ Error in source while trying to extract stream from tns-android@5.0.0. Error is TypeError: The value "false" is invalid for option "readableHighWaterMark"
TypeError: The value "false" is invalid for option "readableHighWaterMark"
    at getHighWaterMark (/home/lucas/.config/yarn/global/node_modules/through2/node_modules/readable-stream/lib/internal/streams/state.js:14:13)
    at new ReadableState (/home/lucas/.config/yarn/global/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:120:24)
    at DestroyableTransform.Readable (/home/lucas/.config/yarn/global/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:182:25)
    at DestroyableTransform.Duplex (/home/lucas/.config/yarn/global/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js:58:12)
    at DestroyableTransform.Transform (/home/lucas/.config/yarn/global/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:106:10)
    at new DestroyableTransform (/home/lucas/.config/yarn/global/node_modules/through2/through2.js:6:13)
    at /home/lucas/.config/yarn/global/node_modules/through2/through2.js:53:12
    at /home/lucas/.config/yarn/global/node_modules/through2/through2.js:46:12
    at Cache.put (/home/lucas/.config/yarn/global/node_modules/make-fetch-happen/cache.js:176:21)
    at fetch.then.res (/home/lucas/.config/yarn/global/node_modules/make-fetch-happen/index.js:352:40)
    at process._tickCallback (internal/process/next_tick.js:68:7)
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, cloud, cloud|setup, 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, devices|android, devices|ios, 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, error-reporting, extension, extension|install, extension|uninstall, generate, help, info, init, install, platform, platform|add, platform|clean, platform|remove, platform|update, plugin, plugin|add, plugin|build, plugin|create, plugin|install, plugin|remove, plugin|update, post-install-cli, prepare, preview, proxy, proxy|clear, proxy|set, publish, publish|ios, resources, resources|generate|icons, resources|generate|splashes, resources|update, run, run|android, run|ios, setup, setup|cloud, test, test|android, test|init, test|ios, update, usage-reporting
Reading help for command 'build|android'. FileName is 'build-android.md'.

To Reproduce
tns build android --bundle

Expected behavior
I expected it to build, or to at least start to build!

Sample project
Generated from this template:

https://github.com/nativescript-vue/vue-cli-template

Additional context
I only increased tns-core-modules to 5.0.1 and tns-android and tns-ios to 5.0.0 as recommended by tns info

I installed the Android SDK from the official source here:

https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip

Then I installed SDK 28 along with the build-tools and platform-tools. No other packages were installed or were required to get tns doctor to report green across the board.

EDIT: I am using Yarn... I will try NPM
EDIT: Same error with npm

@lucasyvas
Copy link
Author

This in fact was due to Yarn. I didn't quite catch all the cases where I'd used Yarn, but once I rolled everything out and to NPM it worked! Closing.

@rosen-vladimirov
Copy link
Contributor

Hey @lucasyvas ,
Thanks for reporting this issue. Indeed there's a problem when CLI is installed via yarn - it does not respect the npm-shrinkwrap.json file that CLI has in its package. The current problem is caused by the pacote package, which depends on mississippi without specifying strict version and even more specifically by the mississippi package itself, which relies on the through2 package:

npm ls through2
nativescript@5.0.0 /home/vladimirov/.nvm/versions/node/v10.13.0/lib/node_modules/nativescript
└─┬ pacote@8.1.6
     └─┬ mississippi@3.0.0
          └── through2@2.0.3 


nativescript$ cat node_modules/pacote/package.json | grep mississippi
    "mississippi": "^3.0.0",


nativescript$ cat node_modules/mississippi/package.json | grep through
    "through2": "^2.0.0"

In CLI's npm-shrinkwrap.json we have set the version of through2 to 2.0.3, so when you use npm to install nativescript, this version is installed. However, as yarn does not respect this file, it installs latest available version that matches the range ^2.0.0 - this is 2.0.4. It looks like there's some problem with it and that leads to the error you've seen.
I'll reopen this issue and change the title, so we can investigate how to resolve it. Thanks for the report.

@rosen-vladimirov rosen-vladimirov changed the title tns build errors: The value "false" is invalid for option "readableHighWaterMark" tns build errors: The value "false" is invalid for option "readableHighWaterMark" when CLI is installed with yarn Nov 6, 2018
@rosen-vladimirov
Copy link
Contributor

Steps to reproduce:

  1. Install yarn
  2. Install nativescript with yarn: yarn global add nativescript
  3. Remove your npm cache: npm config get cache to get the path to cache and rm -rf <path to cache
  4. tns create myApp
  5. tns platform add android --path myApp

@rosen-vladimirov
Copy link
Contributor

Currently the issue cannot be reproduced as through2 had fixed the issue by publishing new version - 2.0.5. However, we still need to add yarn.lock to CLI to prevent such issues in the future.

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