i can't install express in my package.json file in termux - node.js

I tried <code> npm install --save express </code> to install express in my package.json file and it gave me
/storage/emulated/0/swifttest
$ npm install --save express
npm WARN swifttest#1.0.0 No description
npm WARN swifttest#1.0.0 No repository field.
npm ERR! path ../express
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../express' -> '/storage/emulated/0/swifttest/node_modules/express'
npm ERR! { Error: EACCES: permission denied, symlink '../express' -> '/storage/emulated/0/swifttest/node_modules/express'
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, symlink '../express' -> '/storage/emulated/0/swifttest/node_modules/express'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../express',
I know it has to do with permission but i dont know my way around. I use Android 5.1

Run your npm install as root I.e sudo npm install --save express.

Thanks i did it. I figured i went through emulated instead of termux directory. I used data/data/files/home as against emulated i used earlier

Related

Symlink Error When Downloaded NPM packages Globally

I am trying to download an npm package globally, but met with this error. I'm aware that the path where the package is downloaded should be /usr/local/lib/node_modules, but in the error, it seems the path is ../lib/node_modules/nodemon/bin/nodemon.js. I previously downloaded npm/node with Homebrew, but uninstalled it and re-downloaded node through its website.
Node v16.15.0
NPM 8.5.5
MacOS 12.2.1
How can I re-arrange these files so that global packages can be downloaded without this symlink error?
(base) julian#Julians-MacBook ~ % npm install -g nodemon
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/nodemon/bin/nodemon.js
npm ERR! dest /usr/local/bin/nodemon
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/local/bin/nodemon'
npm ERR! [Error: EACCES: permission denied, symlink '../lib/node_modules/nodemon/bin/nodemon.js' -> '/usr/local/bin/nodemon'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/nodemon/bin/nodemon.js',
npm ERR! dest: '/usr/local/bin/nodemon'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user

Why is permission denied in terminal when I tried to install sass using node.js

Why can't I install? Help! I followed this tutorial and it told me to install node.js and I did.
karenchan:~ karenchan$ npm install -g sass
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/karenchan/.npm/_logs/2020-07-30T20_33_04_760Z-debug.log
karenchan:~ karenchan$ npm install -g sass
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/karenchan/.npm/_logs/2020-07-30T20_44_30_523Z-debug.log
karenchan:~ karenchan$
This is the problem:
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
Two solutions:
Install globally as "root", using sudo
sudo npm install -g sass
Install locally (so "permissions" shouldn't be an issue):
cd <<my project>>
npm install sass
FYI, other options might include:
Edit your project's package.json
Install and use NVM
Here's a good tutorial on the latter:
Installing Node.js Tutorial: Using nvm, Tierney Cyren

How to install react-native?

I'm trying to install react native through npm, and I've got a mistake in the console
Air-Anton: ant anton$ npm i -g create-react-native-app
npm WARN checkPermissions Missing write access to
/usr/local/lib/node_modules npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm
ERR! Error: EACCES: permission denied, access
'/usr/local/lib/node_modules' npm ERR! { Error: EACCES: permission
denied, access '/usr/local/lib/node_modules' npm ERR! stack: 'Error:
EACCES: permission denied, access '/usr/local/lib/node_modules'',
npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall:
'access', npm ERR! path: '/usr/local/lib/node_modules' } npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/anton/.npm/_logs/2018-08-12T16_40_46_899Z-debug.log Air-Anton:
ant anton$
Help how can I fix it?
It looks like you need root privileges to install react native cli since you don't have the right perms to install binaries in /usr/local/lib/node_modules.
Run the same command with sudo or login temporarily as root. Try the following
$ sudo npm i -g create-react-native-app
Alternatively, you could login as root
$ su
[Enter root password]
# npm i -g create-react-native-app

Trouble installing Angular cli

Im trying to install the angular cli using terminal but i keep getting this error
-
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
**npm ERR! Please try running this command again as root/Administrator.
➜ ~**
I am using my admin account so i am not sure why it is not working, also i have installed node.js just fine without any issues.
Check if your application has package.json. If not then run
npm init
If package.json exists try running
npm i
and then run
npm i -g #angular/cli
Try using --allow-root flag
sudo npm install #angular/cli -g --allow-root

npm install -g doesn't work for anything

I'm trying to install gatsbyjs using npm using the following command in terminal: npm install -g gatsby-cli. I got a warning and a bunch of errors:
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/simanshrestha/.npm/_logs/2018-07-07T22_48_08_615Z-debug.log
I tried reinstalling Node.js and updating npm using: npm install npm#latest -g but only got a bunch of check permission warnings and the following errors:
npm ERR! path /usr/local/lib/node_modules/npm/node_modules/cacache/node_modules/ssri
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/cacache/node_modules/ssri'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/cacache/node_modules/ssri'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm/node_modules/cacache/node_modules/ssri\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/npm/node_modules/cacache/node_modules/ssri' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/simanshrestha/.npm/_logs/2018-07-07T22_49_59_092Z-debug.log
I've been trying to fix the permission errors, but am stuck (I'm really new to this stuff).
Edit: I don't want to use sudo as I have seen that it could mess things up from multiple forums.
There are 3 possible solutions to your problem, which is basically lack of root access to install modules to root node_modules dir:
Run sudo npm i -g package#latest. This will fix your problem but will ask for root password every time.
Change your default global modules folder as outlined here with npm config set prefix
Install and use nvm to manage node and npm, it comes out of the box with properly set up folder structure within your local user. So no extra rights needed or messing with config prefixes.
You should run npm install -g as an administrator.
As the console said.

Resources