Sudharsan Venkatraj
Sudharsan Venkatraj

Reputation: 581

Installation issue in Nativescript

Hi I am using Mintos(Linux) platform. For create Andriod app Angular based using Nativescript so i installed Nativescript successfully installed node.js version 8.10.0. When i tried to install nativescript cmd npm install -g nativescript It was showing error like

mint2@mint2-ASAG3730-ASAG1730:~$ npm install -g nativescript
    npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/nativescript
    npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/nativescript/node_modules/fsevents/node_modules
    npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
    /usr/local/lib
    +-- [email protected] 
    `-- [email protected] 
      `-- [email protected] 

    npm WARN [email protected] requires a peer of typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev but none was installed.
    npm WARN [email protected] requires a peer of typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev but none was installed.
    npm ERR! Linux 4.15.0-20-generic
    npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "nativescript"
    npm ERR! node v8.10.0
    npm ERR! npm  v3.5.2
    npm ERR! path /usr/local/lib/node_modules/nativescript
    npm ERR! code EACCES
    npm ERR! errno -13
    npm ERR! syscall access

    npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/nativescript'
    npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/nativescript'
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'access',
    npm ERR!   path: '/usr/local/lib/node_modules/nativescript' }
    npm ERR! 
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/mint2/npm-debug.log

Upvotes: 2

Views: 1936

Answers (5)

user13423237
user13423237

Reputation:

Im using Windows 10

and it works when you put a force on your command like this:

npm install -g nativescript -f

Hope it helps Regards Atif

Upvotes: -1

Wayne Riesterer
Wayne Riesterer

Reputation: 781

To avoid all these kinds of problems on Linux, the best solution that I've found is to use Node Version Manager.

You can install it using:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Logout and log back in again for the path updates to take effect.

After this, see what Node versions are available:

nvm list-remote

Pick a version and install it, for example:

nvm install v12.3.1

nvm will automatically use this version (or whatever other version you selected).

You can install other versions as required and switch between versions using (for example):

nvm use v12.3.0

The advantages of doing things this way are at least the following:

  • No more access control issues
  • You can swap between Node versions as you please

Here's a repo link for further information: https://github.com/nvm-sh/nvm

Upvotes: -1

Axel
Axel

Reputation: 5131

Try this:

sudo npm install nativescript -g --unsafe-perm

Source: https://docs.nativescript.org/start/ns-setup-linux

Upvotes: 0

Martin Mtawali
Martin Mtawali

Reputation: 31

you need to be root to install sir sudo npm i -g nativescript@latest to write to /user/local which is a protected directory

Upvotes: -1

nemesv
nemesv

Reputation: 139798

npm does not have the necessary permissions to install nativescript:

EACCES: permission denied, ...

From the nativescript installation notes:

If you’re on macOS and receive an EACCES error, you either need to rerun the previous command with sudo — that is, sudo npm install -g nativescript — or take a moment to fix your npm permissions so that you don’t need admin rights to globally install npm packages.

Upvotes: 4

Related Questions