Koding - Yeoman - AngularFullStack Cannot Create Scaffolding - node.js

Hello i am using Koding Cloud Based Ubuntu Development environment.
I've managed to is install all prerequisites required for Yeoman Angular FullStack.
Installed Successfully below items
sudo npm install -g yo grunt-cli bower karma
sudo npm install -g generator-angular-fullstack
After installing above.
i've created abltd directory (Folder structure shown below)
and ran following command
yo angular-fullstack abltd
it ran all to the end and throwing following error.
1070 error Error: EACCES, mkdir '/home/abitandco/tmp/npm-1293-IkfHqNho'
1070 error { [Error: EACCES, mkdir '/home/abitandco/tmp/npm-1293-IkfHqNho']
1070 error errno: 3,
1070 error code: 'EACCES',
1070 error path: '/home/abitandco/tmp/npm-1293-IkfHqNho',
1070 error parent: 'abltd' }
1071 error Please try running this command again as root/Administrator.
1072 error System Linux 3.13.0-29-generic
1073 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install"
1074 error cwd /home/abitandco/abltd
1075 error node -v v0.10.26
1076 error npm -v 1.4.3
1077 error path /home/abitandco/tmp/npm-1293-IkfHqNho
1078 error code EACCES
1079 error errno 3
1080 error stack Error: EACCES, mkdir '/home/abitandco/tmp/npm-1293-IkfHqNho'
1081 verbose exit [ 3, true ]
i tried running as sudo yo angular-fullstack abltd but no difference.
i am adding complete log and image as well to help understand problem better.
Can anyone point me in right direction please.
I have complete npm debug log if any one wants to see it.

its likely that your ~/.npm or ~/tmp directories are owned by the root user. try again but ensure that those directories are owned by your username.

Give yourself permission using the following command
sudo chown -R youruser /home/youruser

Related

Error "Permission denied" after execute npm install

After executing npm install, occurs following error:
npm ERR! code 127
npm ERR! path /var/www/html/node_modules/core-js
npm ERR! command failed
npm ERR! command sh -c node -e "try{require('./postinstall')}catch(e){}"
npm ERR! sh: 1: node: Permission denied
I'm executing command as a root on Docker. I tried to set npm config set user 0 and npm config set unsafe-perm true but nothing changed.
I changed files ownership to root, and after that everything work.
chown -R root:root .
This is a common problem when you install packages using sudo. That's why you shouldn't install any package using sudo keyword.
The solution: Delete node_modules folder. If it says that you don't have permission then delete it directly from folder (not from IDE) or through the terminal.
After that install your packages again. This time only npm i without sudo.

How to fix permission being denied when installing Angular Client on MacOS?

I am a new coder trying to get started with Angular and Node following a tutorial on Udemy. I have successfully (I think) installed Node.js and I'm running version 16.15.1 but when I try to install the angular client it fails every time (screenshot attached). Please could someone point out where I am going wrong?
FYI my name is Manraj and I am the only user on my mac (hence I am an admin) so that is why it appears in the code as Manrajs MBP as that is the name of my laptop.
Last login: Tue Jun 21 15:35:36 on ttys000
[manrajsandhu#Manrajs-MBP~ % node
v16.15.1
(manrajsandhu#Manrajs-MBP ~ % pm itstall -g #angular/cli
pm WARN config global
--global
--local
are deprecated. Use
npm
ERRII
code EACCES
npm
ERR syscall rename
npm
RR
path /usr/local/lib/node_modules/#angular/cli
npm
ERR
dest /usr/local/lib/node modules/#angular/.cli-G39XYeT9
AR
errno -13
-location=global
instead.
npm
nom
PRR
non
SRR
npm
npm
-RR
•RR
npm
RR
npm
nom
ERR
ERD
nom
RR
Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/#angular/cli'
->
[Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/#angular/cli'
"/usr/local/lib
errno: -13,
"/usr/local/1
code: 'EACCES
syscall: 'rename'
path: '/usr/local/lib/node_modules/#angular/cli
dest:'/usr/local/lib/node_modules/Cangular/.cli-639XYeT9'
npm
ERR
npm
ERRI
npm
ERRI
npm
ERR
The operation was rejected by your operating system
It is likely you do not have the permissions to access this file as the current user
npm
RR
npm
ERR
npm
If you believe this might be a permissions issue, please double-check the
permissions of the file and its containing directories,
the command again as root/Administrator
or try running
nom
ERRII
mpm
EDD
A complete log of this run can be found in:
/Users/manrajsandhu/.npm/_logs/2022-06-21T14_36_16_571Z-debug-0.10g
manrajsandhu#Manrajs-MBP
%
You need root privileges. Just use sudo.
sudo npm install -g #angular/cli

EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging

I'm trying to run npm install on my project but its showing EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules.staging
I don't have root administrative access. I'am using as local user in my system and my system is windows 10
node v10.16.3
npm v6.11.3
Can any one please help me to resolve this issue. I'am requesting you guys please.
3235 error code EPERM
3236 error syscall mkdir
3237 error path C:\Program Files\nodejs\node_modules\.staging
3238 error errno -4048
3239 error Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'
3239 error { [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging']
3239 error cause:
3239 error { Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'
3239 error errno: -4048,
3239 error code: 'EPERM',
3239 error syscall: 'mkdir',
3239 error path: 'C:\\Program Files\\nodejs\\node_modules\\.staging' },
3239 error stack:
3239 error 'Error: EPERM: operation not permitted, mkdir \'C:\\Program Files\\nodejs\\node_modules\\.staging\'',
3239 error errno: -4048,
3239 error code: 'EPERM',
3239 error syscall: 'mkdir',
3239 error path: 'C:\\Program Files\\nodejs\\node_modules\\.staging',
3239 error parent: 'nodemon' }
3240 error The operation was rejected by your operating system.
3240 error It's possible that the file was already in use (by a text editor or antivirus),
3240 error or that you lack permissions to access it.
3240 error
3240 error If you believe this might be a permissions issue, please double-check the
3240 error permissions of the file and its containing directories, or try running
3240 error the command again as root/Administrator.
3241 verbose exit [ -4048, true ]
Try clearing the cache:
npm cache clean --force
Or
npm uninstall npm -g
npm install npm -g
Or
npm set prefix 'C:\Users\User\AppData\Roaming\npm'
The last one worked for me
run these commands:
npm uninstall -g create-react-app
npm install -g create-react-app
that's will upgrade your npx, then run
npx create-react-app my-app
Open your command line (CMD) as an admin.
Navigate to your project directory.
Install the package globally e.g nodemon or any other npm package.
This worked for me.
on windows 10 👍
From Start Menu : type "CMD" then "run as administrator"
then continue using "Node Commands"
Delete 'C:\Users\User\AppData\Roaming\npm' folder or just rename it (like to 'npm_') to be on safe side, and then run command:
npm install
this will create 'C:\Users\User\AppData\Roaming\npm' folder again.
This worked for me.
Run
npm cache clear
npm install npm -g
If you run the command npm cache clear get error, it means you don't have npm installed yet, just run the following command: npm install npm -g
Then close command prompt or visual studio code and run it again to take effect
Today we ran into the same problem. It turned out that there was a environment variable set:
NPM_CONFIG_PREFIX=C:\Program Files\Nodejs
Removing this environment variable fixed the problem fo us.
I solve this issue...
Firstly you change your drive
c drive change make new drive D and then run your command
D:\nodejs> vue create hello-world
this is what worked for me

Issue with webpack and npm package installation in ubuntu

I was suddenly having an issue in my project like this.
It was repeated and crashed my chrome:
So, I downgraded some of my packages and I downgraded my npm to 6.6.0 which was stable for my project. The main problem started after that. I removed the node_modules folder and when I tried to
sudo npm install [because npm install says permission issue]
it started showing these errors:
npm info it worked if it ends with ok npm verb cli [ '/usr/bin/node',
npm verb cli '/data/data/com.termux/files/usr/bin/npm', npm verb cli
'i', npm verb cli '-g', npm verb cli 'npm', npm verb cli
'--verbose' ] npm info using npm#6.6.0 npm info using node#v10.15.0 npm
verb npm-session 3b7ba2a77f7e848c Unhandled rejection Error: EACCES:
permission denied, link '/home/.npm/_cacache/tmp/6a547224' ->
'/home/.npm/_cacache/content-v2/sha512/d8/e0/f8cb9554c1f6f974b32fe943e4df8353fca3cb4843dbeda6fe0d88d14eb91bec5d23ddde1751af76721044d662b479ec4c9df9f0bfcce592bbc9fc2b6f72'
at Error (native)
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error
at: npm ERR! https://github.com/npm/npm/issues
npm ERR! A complete log of this run can be found in: npm ERR!
/home/.npm/_logs/2017-06-28T00_20_47_543Z-debug.log
I have also tried npm cache clear -f
and also tried to install npm install --no-cache
But it was having problem with npm install and somehow I was getting the previous build.
I have solved this issue by changing the permission level of my user. This was an issue because in ubuntu the node_modules folder had by default root folder permission. I have checked this by this command:
in my project folder: ls -la
So I got a whole list where I have seen the permission for node_modules was like this:
drwxrwsrwx 906 root www-data 36864 মে 14 16:17 node_modules
-rw-r--r-- 1 my_username www-data 2407 মে 14 16:14 package.json
But my user didn't have the permission to write.
So what I did is:
sudo chown -R my_username:my_username node_modules/
It solved my problem.

npm ERR! code EACCESS by installing #angular/cli

Environment:
Ubuntu 16.04
node v8.11.1 (installed with package manager)
npm v5.6.0
After the clean installation of npm and trying to install #angular/cli
npm install -g #angular/cli
I'm getting an error related with EACCESS that it is probably related with permissions because it disappears with root access. The thing is that it is not recommended to use it that way, so how could I solve this?
Console ERROR
$ npm install -g #angular/cli
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/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! /home/user/.npm/_logs/2018-04-25T15_23_36_781Z-debug.log
File .npm/_logs/2018-04-25T15_23_36_781Z-debug.log
2566 warn checkPermissions Missing write access to /usr/lib/node_modules
2567 verbose stack Error: EACCES: permission denied, access '/usr/lib/node_modules'
2568 verbose cwd /opt/workspace/roscam-front
2569 verbose Linux 2.6.32-042stab120.19
2570 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "#angular/cli"
2571 verbose node v8.11.1
2572 verbose npm v5.6.0
2573 error path /usr/lib/node_modules
2574 error code EACCES
2575 error errno -13
2576 error syscall access
2577 error Error: EACCES: permission denied, access '/usr/lib/node_modules'
2577 error { Error: EACCES: permission denied, access '/usr/lib/node_modules'
2577 error stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
2577 error errno: -13,
2577 error code: 'EACCES',
2577 error syscall: 'access',
2577 error path: '/usr/lib/node_modules' }
2578 error Please try running this command again as root/Administrator.
2579 verbose exit [ -13, true ]
One option to deal with this problem will be to change npm's default directory to use a different directory.
We need to make a directory for global installations, in this example inside user directory:
mkdir ~/.npm-global
We configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
We update your system variables:
source ~/.profile
Now we can test by installing a package globally without using root permissions.
npm install -g jsonfile
Another option to avoid all these steps and modifying ~/.profile, it will be by defining an ENV variable with the following command(:
NPM_CONFIG_PREFIX=~/.npm-global
npm reference
I had the EACCES permission error too. I did a fresh install of Ubuntu 18.04. The 16.04 version may not be much different. It all works for me. Hope this helps.
----------- FOR YOU, YOU SHOULD APPLY THIS CODE FROM HERE
sudo apt-get install curl software-properties-common
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install nodejs
node -v
npm -v
npm init
whoami
which npm # returned /usr/bin
npm config get prefix # returned /usr
npm config set prefix /usr/bin
npm config get prefix
ls -la /usr/bin/npm # has a symbolic link to ../lib/node_modules/npm/bin/npm-cli.js
sudo chown -R your_user /usr/bin/npm # NOT /usr/bin or we lock out sudo too!!!!
sudo chown -R your_user app-folder/
ls -la /usr/bin/npm
npm init # I was curious to see if this still works
npm install # WORKS GREAT!!! No need for sudo now.:)
----------- TO THERE
THIS IS THE USE CASE I WORKED ON AFTER I INSTALLED THE ABOVE. YOURS SHALL WORK TOO IF THE ABOVE IS WELL SET UP.
npm start # script
npm run start:prod # works as well
npm i debug --save-dev # works but need to install 'make'
sudo apt install build-essential
npm i debug --save-dev # installed and launched successfully!
Note: if you were to install
npm i debug --global instead,
you may still get that EACCES permission error as your local user will not be able to access root permissions elsewhere in your file system. That's why we use 'change ownership' (i.e. chown your_user: see above in the code).

Resources