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

Missing yargs-parser dependency #4814

Closed
aparajita opened this issue Jul 7, 2019 · 0 comments
Closed

Missing yargs-parser dependency #4814

aparajita opened this issue Jul 7, 2019 · 0 comments
Assignees
Labels
bug tslint Describes that we need to add tslint rule to validate the behavior will not happen in the future.
Milestone

Comments

@aparajita
Copy link

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):

  • CLI: 5.4.2
  • Cross-platform modules: 5.4.0
  • Android Runtime: 5.4.0
  • iOS Runtime: 5.4.0

Describe the bug

package.json is missing yargs-parser as a dependency. It is required here. You are getting away with it currently because npm and yarn currently use a flattened package hierarchy, and yargs installs yargs-parser. That's an implementation detail of the package manager that should not be relied on. Smarter package managers like pnpm (and no doubt future versions of npm and yarn) which do not flatten the hierarchy cause tns to break.

To Reproduce

  1. npm i -g pnpm.
  2. pnpm i -g nativescript
  3. tns info

You'll get something like this error output:

Cannot find module 'yargs-parser'
Require stack:
- /Users/aparajita/.nvm/versions/node/v12.6.0/pnpm-global/2/node_modules/.registry.npmjs.org/nativescript/5.4.2/node_modules/nativescript/lib/options.js
- /Users/aparajita/.nvm/versions/node/v12.6.0/pnpm-global/2/node_modules/.registry.npmjs.org/nativescript/5.4.2/node_modules/nativescript/lib/common/yok.js
- /Users/aparajita/.nvm/versions/node/v12.6.0/pnpm-global/2/node_modules/.registry.npmjs.org/nativescript/5.4.2/node_modules/nativescript/lib/common/bootstrap.js
- /Users/aparajita/.nvm/versions/node/v12.6.0/pnpm-global/2/node_modules/.registry.npmjs.org/nativescript/5.4.2/node_modules/nativescript/lib/bootstrap.js
- /Users/aparajita/.nvm/versions/node/v12.6.0/pnpm-global/2/node_modules/.registry.npmjs.org/nativescript/5.4.2/node_modules/nativescript/lib/nativescript-cli.js
- /Users/aparajita/.nvm/versions/node/v12.6.0/pnpm-global/2/node_modules/.registry.npmjs.org/nativescript/5.4.2/node_modules/nativescript/bin/tns

Now do this:

  1. pnpm i -g yargs-parser
  2. tns info

No error.

Expected behavior

All packages that are directly required by source code should be declared in package.json. If that is done there will be no missing module error.

Sample project

Additional context

@rosen-vladimirov rosen-vladimirov added bug tslint Describes that we need to add tslint rule to validate the behavior will not happen in the future. labels Jul 15, 2019
Fatme added a commit that referenced this issue Jul 16, 2019
NativeScript CLI doesn't respect correctly `hmr: false` when the option is provided through dashed options from command. This led to the exception when the application is built using CLI and deployed on device using Xcode as the `hmr` is included in app's bundle.

Fixes:
#4846
#4814
Fatme added a commit that referenced this issue Jul 16, 2019
NativeScript CLI doesn't respect correctly `hmr: false` when the option is provided through dashed options from command. This led to the exception when the application is built using CLI and deployed on device using Xcode as the `hmr` is included in app's bundle.

Fixes:
#4846
#4814
Fatme added a commit that referenced this issue Jul 16, 2019
NativeScript CLI doesn't respect correctly `hmr: false` when the option is provided through dashed options from command. This led to the exception when the application is built using CLI and deployed on device using Xcode as the `hmr` is included in app's bundle.

Fixes:
#4846
#4814
@Fatme Fatme added this to the 6.0.1 milestone Jul 16, 2019
@Fatme Fatme self-assigned this Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug tslint Describes that we need to add tslint rule to validate the behavior will not happen in the future.
Projects
None yet
Development

No branches or pull requests

4 participants