A package manager is a piece of software that lets you manage the external code, written by you or someone else, that your project needs to work correctly. By default, NativeScript CLI uses Node Package Manager (
npm) for managing the dependencies of the application. When new application is created, CLI automatically calls
npm install to install all of its dependencies.
NativeScript CLI allows you to configure the package manager used when working with dependencies. When you change the defaultly used
npm package manager, CLI will use the newly set package manager for all operations it executes related to project dependencies, for example, project creation, managing dependencies, etc.
NativeScript CLI supports three package managers:
npm- this is the default option
yarn- you can set it by calling
tns package-manager set yarn. More information about
yarnis available here
pnpm- from version 6.4, you can use
pnpmto manage the dependencies of your application. You can use
tns package-manager set pnpm. NOTE: You will have to use
--shamefully-hoistflag if you call
pnpmon your own. CLI passes this flag when installing dependencies with
pnpmand probably your application will not work if you omit it. More information about
pnpmis available here.
In case you want to check what is the currently used package manager, you can use:
$ tns package-manager get