When I try to create a new Angular 4 project with 'ng new myProject', the project folder, sub folders and files are created,
but I also always get these errors:
npm ERR! path c:\projects\hello-world\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rmdir
npm ERR! Error: EPERM: operation not permitted, rmdir 'c:\projects\hello-world\node_modules\fsevents\node_modules'
npm ERR! { Error: EPERM: operation not permitted, rmdir 'c:\projects\hello-world\node_modules\fsevents\node_modules'
npm ERR! stack: 'Error: EPERM: operation not permitted, rmdir \'c:\\projects\\hello-world\\node_modules\\fsevents\\node_modules\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rmdir',
npm ERR! path: 'c:\\projects\\hello-world\\node_modules\\fsevents\\node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
I open the Node.js command prompt as Administrator when I issue the ng new command.
I am using Win7 Pro. I have install the following successfully and without any errors. The ng -v returns the following:
-Angular CLI: 1.5.0
-Node: 8.9.0
-OS: win32 x64
-Angular:
npm -v returns: 5.5.1
I give my user account, based on the 'whoami' results, full admin permissions to the myProject folder, the C:\Users\myAccount\AppData\Roaming\npm folder and %APPDATA%\npm-cache folder.
I also perform a 'npm cache verify'.
But I still get the above errors on the ng new command.
How do I correct these errors? Or can I ignore these errors?
If you still run into this problem, one reason you might be running into this is that you installed your CLI tools (#angular/cli) using either 'sudo npm install -g #angular/cli' or as root, from the 'sudo su - root' command, then simply 'npm install -g #angular/cli', and your problem seems to arise whenever you're not logged in and calling an 'ng' command as root or with 'sudo'. This makes sense, but it always causes some kind of insufficient permission related error; and it's not even your fault.
You can easily try to fix or mitigate this serious error by creating and saving a dot-file named '.npm-global' in your home directory ('~/'), then running the command, npm config set prefix '~/.npm-global'.
Then, simply include the line in either /etc/profile or ~/.profile, export PATH=~/.npm-global/bin:$PATH, and run 'source /etc/profile' or 'source ~/.profile' to finalize it. [1]
After that, simply remove anything Node, like 'node_modules/', 'package-lock.json', just all of it.... Then, try installing your NPM packages again -- this time, without using 'sudo' and without root signed in.
https://docs.npmjs.com/getting-started/fixing-npm-permissions
Related
Run NPM Install
returncode: 126
stdout:
> zenitcouture#1.0.0 start /home/zenitcou/zenitcouture
> nodemon app.js
stderr:
npm WARN lifecycle The node binary used for scripts is /home/zenitcou/nodevenv/zenitcouture/10/bin/node but npm is using /opt/alt/alt-nodejs10/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: /home/zenitcou/zenitcouture/node_modules/.bin/nodemon: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! zenitcouture#1.0.0 start: `nodemon app.js`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the zenitcouture#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/zenitcou/.npm/_logs/2021-10-09T17_17_22_982Z-debug.log
the above is my code. I'm trying to upload it to my cpanel and run it but i keep getting this error. I've stopped the app, and restarted it, the same error.
An error occured during installation of modules. The operation was performed, but check availability of application has failed. Web application responds, but its return code "500 Internal Server Error" or content type before operation "text/html; charset=UTF-8" doesn't equal to contet type after operation "text/html; charset=UTF-8".
i also get this error above if i dont stop the app before installing npm
for some reason ive been ending up with "command not found" when i type in the create-react-app newproject command. Its been giving me this error:
npm WARN checkPermissions Missing write access to /Users/kennyquach/.npm-global/lib/node_modules/create-react-app
npm ERR! path /Users/kennyquach/.npm-global/lib/node_modules/create-react-app
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/kennyquach/.npm-global/lib/node_modules/create-react-app'
npm ERR! { Error: EACCES: permission denied, access '/Users/kennyquach/.npm-global/lib/node_modules/create-react-app'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/Users/kennyquach/.npm-global/lib/node_modules/create-react-app\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/Users/kennyquach/.npm-global/lib/node_modules/create-react-app' }
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 (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kennyquach/.npm/_logs/2018-11-28T17_50_32_739Z-debug.log
any help is appreciated! Thanks!
As the error clearly shows you dont have write access to /Users/kennyquach/.npm-global/lib/node_modules/create-react-app
try changing access to 777 for all of .npm-global folders and then give a try.
You are high likely using Mac OS as Operating System. This is a general issue of globally installed packages in MacOS that caused by built-in node application's file permissions. Actually you can get over this by executing create-react-app as root, but i don't recommend that, it's not useful and it's risky.
So you got 2 options. (First one is hard to do, second is blazing fast)
1-) Completely remove Node from your System and install it with Brew. You can easily update node with that package manager and install any other popular developer tools too (Like: mongodb, mysql, pgsql, rabbitmq etc.).
You can get brew from here: https://brew.sh and install node with that code: brew install node
2-) You can easily give read, write, execute access to your folders and files. You can do it like this: sudo chmod -R 777 /Users/kennyquach/.npm-global/ when sudo asks your password, use your Administrator password.
This looks like an access issue. I faced same issue in MAC OS X, when I tried running the command with sudo, it worked for me.
sudo npm install -g create-react-app
I transferred a ReactJS + NodeJS project from another computer to a new computer. Then inside the folder, I did npm install in the terminal but getting the following response back.
> fsevents#1.0.14 install /Users/Joshua/Projects/practice_project/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/Joshua/Projects/practice_project/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
And on the previous computer, I ran the project via npm run server, but when I do it after npm run server in the project on the new computer, now I am getting:
> practice_project#1.0.0 serve /Users/Joshua/Projects/practice_project
> nodemon server/server.js --ignore components
sh: nodemon: command not found
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "serve"
npm ERR! node v4.6.1
npm ERR! npm v2.15.9
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! practice_project#1.0.0 serve: `nodemon server/server.js --ignore components`
npm ERR! spawn ENOENT
I looked around but can't seem to find the right solution. Tried npm install -g node-gyp but getting tar.unpack untar error.
What could be the issue? Will upvote and accept the answer. Thank you.
In this case, the first message you received is just telling you it's attempting to rebuild the fsevents package for your environment, then realized it already had it built, so stopped the process.
The second message is indicating that you are attempting to run nodemon but it isn't installed. I would hazard a guess that it was installed globally on your previous machine (and therefore not included in the project's package.json). If you want to install it globally again, you'll need to run npm i -g nodemon.
I am trying to run npm install on my terminal as part of the setup for angular-phonecat as per the instructions on https://docs.angularjs.org/tutorial
When I run the command I am getting issues with deprecated modules and errors when reaching the bower install section.
Does anybody know how I can update the deprecated modules to avoid the warnings and how I can fix the bower errors?
Here is the output I am receiving:
npm WARN deprecated tough-cookie#2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
-
> fsevents#1.0.14 install /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/karma/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
[fsevents] Success: "/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/karma/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
> angular-phonecat#0.0.0 postinstall /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat
> bower install
bower EACCES EACCES: permission denied, unlink '/Users/Eamon/.cache/bower/registry/bower.herokuapp.com/lookup/jquery_d223e'
Stack trace:
Error: EACCES: permission denied, unlink '/Users/Eamon/.cache/bower/registry/bower.herokuapp.com/lookup/jquery_d223e'
at Error (native)
Console trace:
Error
at StandardRenderer.error (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/renderers/StandardRenderer.js:81:37)
at Logger.<anonymous> (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/bin/bower.js:110:26)
at emitOne (events.js:77:13)
at Logger.emit (events.js:169:7)
at Logger.emit (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/bower-logger/lib/Logger.js:29:39)
at /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/commands/index.js:48:20
at _rejected (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:844:24)
at /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:870:30
at Promise.when (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:1122:31)
at Promise.promise.promiseDispatch (/Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/node_modules/bower/lib/node_modules/q/q.js:788:41)
System info:
Bower version: 1.7.9
Node version: 4.4.0
OS: Darwin 15.6.0 x64
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.0
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! angular-phonecat#0.0.0 postinstall: `bower install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular-phonecat#0.0.0 postinstall script 'bower install'.
npm ERR! This is most likely a problem with the angular-phonecat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bower install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-phonecat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls angular-phonecat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/Eamon/Documents/Scripting/Web Development/Learning/Javascript/Angularjs/angular-phonecat/npm-debug.log
I have tried searching on other posts with similar issues but none of these have helped me find a solution:
error when npm install
Got an error while running "npm install" on angular-phonecat directory
Cannot npm install for angular-phonecat tutorial : Cannot find module 'update-notifier'
I have also tried running sudo npm install with the same issue. I have a feeling the bower install issues are due to the setup of the bower cache looking at the error output but I am not 100% certain.
Has anyone encountered similar issues when setting up the installation for angular-phonecat?
Any help would be greatly welcomed.
Many Thanks,
Eamon
ISSUE: You (the user) don't have the right set of permissions for the directory.
The instant way out is to run the npm install using sudo, but this may give you the same error, or improper installation.
AND changing directory ownership is not a good option, a temporary patch. I am answering the question, as I feel I have a more elegant solution/suggestion to the problem. I came across same issues multiple times i.e. 'npm install -g #angular/cli'.
Uninstalled the package and executed the following commands (in the order mentioned) to have clean installation.
Solution/Suggestion: Change npm's Default Directory (from official docs)
Back-up your computer before moving forward.
(optional) In case you have a erroneous installation, first uninstall it:
npm uninstall <package-name> # use sudo if you used it while installation
npm cache verify # or, npm cache clean for npm version below 5.x.x
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile or ~/.bash_profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables, or restart the terminal:
source ~/.profile
(optional) Test: Download a package globally without using sudo.
npm install -g jshint
Having looked into this it appears that bower was having issues with permissions and was resolved by running the bower install separately using sudo:
sudo bower install --allow-root
However, you should not use sudo with bower. It is likely that if you have to then the ~/.cache has been set incorrectly either by installing using sudo or installing your first package via sudo. More info about this can be found here: http://www.competa.com/blog/2014/12/how-to-run-npm-without-sudo/
Instead you should rectify the ownership by running the following:
sudo chown -R $user ~/.npm
sudo chown -R $user ~/.config
To find your user you can simply run the following command on the command line:
$ whoami
If you want to open to a wider group you can also add a group to the chown command. To find out which group your user belongs to you can type the following command:
$ groups
To set the group at the same time as the user simply change the command to the following and replace $user and $group with your desired user and group:
sudo chown -R $user:$group ~/.npm
sudo chown -R $user:$group ~/.config
If you are seeing an issue like one of the below when running a bower install during your npm install:
EACCES: permission denied, open '/some/directory'
EACCES: permission denied, unlink '/some/directory'
You will need to change the permissions to the folder containing the file to be your user by doing:
sudo chown -R USER /some/directory
Just change the folder that the file is stored in, not the file itself. When you run npm install after this it will work if it needs to install any bower components that are having issues installing while using your current user and not using sudo.
Thanks,
Eamon
when i wrote in my "npm cache clean" this error is occurring "npm ERR! Windows_NT 6.3.9600 npm ERR! argv
C:\iaAC>npm cache clean
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "cache" "clean"
npm ERR! node v0.12.3
npm ERR! npm v2.9.1
npm ERR! path C:\Users\AKASH\AppData\Roaming\npm-cache
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, rmdir 'C:\Users\AKASH\AppData\Roaming\npm-cache'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, rmdir 'C:\Users\AKASH\AppData\Roaming\npm-cache']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\Users\\AKASH\\AppData\\Roaming\\npm-cache' }
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! C:\iaAC\npm-debug.log
Edit: Cleanup
As of npm#5, the npm cache self-heals from corruption issues and data e
xtracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
If you're sure you want to delete the entire cache, rerun this command with --force.
npm cache clean --force
The error you posted suggests to run 'npm cache clean' as an administrator. You will need to open up a command prompt as Administrator, as shown here.
Steps:
Click Start, click All Programs, and then click Accessories.
Right-click Command prompt, and then click Run as administrator.
If the User Account Control dialog box appears, confirm that the
action it displays is what you want, and then click Continue.
Description of the error code you received (EPERM)
EPERM: "operation not permitted" simply means the issue is not a matter of granting elevated privileges. Some operations, even with root permissions, aren't allowed by the OS.
Over 7 years later in mid-January 2023 using npm 9.3.0 on 64-bit Windows 11 Version 22H2 (OS Build 22621.1105), this same error EMFILE too many open files is happening again. The only thing that works to fix the issue is npm cache clean --force followed by reinstalling everything that was in the global npm cache using npm ls -g to understand how many npm install -g commands to issue. I would strongly suggest running npm cache verify before and after each npm install -g command.