Error while creating new project in angular - node.js

I am trying to create new angular project using the command ng new my-app. And the installed versions are listed below
Angular CLI : 6.0
Node version : 10.5.0
Npm : 6.1.0
I am getting the following error message,
ERR! path D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts'
npm ERR! { [Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, unlink 'D:\ng\newapp\node_modules\.staging\typescript-4c0ca0e6\lib\lib.dom.d.ts'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'D:\\ng\\newapp\\node_modules\\.staging\\typescript-4c0ca0e6\\lib\\lib.dom.d.ts' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, unlink \'D:\\ng\\newapp\\node_modules\\.staging\\typescript-4c0ca0e6\\lib\\lib.dom.d.ts\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path:
npm ERR! 'D:\\ng\\newapp\\node_modules\\.staging\\typescript-4c0ca0e6\\lib\\lib.dom.d.ts',
npm ERR! parent: '#angular-devkit/build-optimizer' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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).

temporary fix, downgrade npm to 5.3
npm install npm#5.3 -g

Use administrator privileges. Error says you are not using admin CMD

Install packages after closing your code editor,

Are you using Node Cmd or any IDE(like VSCode) to create new project
try this command
npm i -g #angular/cli
ng new app-name
cd app-name.
ng serve

Related

npm ERR! Error: EPERM: sysCall: 'RENAME', Operation not permitted

When I execute npm install I get the following error:
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\#tootallnate
npm ERR! dest C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\node-gyp\node_modules\#tootallnate
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\#tootallnate' -> 'C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\node-gyp\node_modules\#tootallnate'
npm ERR! { [Error: EPERM: operation not permitted, rename 'C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\#tootallnate' -> 'C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\node-gyp\node_modules\#tootallnate']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\.node-gyp.DELETE\node_modules\#tootallnate' -> 'C:\Users\Vaneeza10698\Downloads\ServiceQualityFinal\react-reduction\node_modules\npm\node_modules\node-gyp\node_modules\#tootallnate'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path:
npm ERR! 'C:\\Users\\Vaneeza10698\\Downloads\\ServiceQualityFinal\\react-reduction\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\#tootallnate',
npm ERR! dest:
npm ERR! 'C:\\Users\\Vaneeza10698\\Downloads\\ServiceQualityFinal\\react-reduction\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\#tootallnate' },
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, rename \'C:\\Users\\Vaneeza10698\\Downloads\\ServiceQualityFinal\\react-reduction\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\#tootallnate\' -> \'C:\\Users\\Vaneeza10698\\Downloads\\ServiceQualityFinal\\react-reduction\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\#tootallnate\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path:
npm ERR! 'C:\\Users\\Vaneeza10698\\Downloads\\ServiceQualityFinal\\react-reduction\\node_modules\\npm\\node_modules\\.node-gyp.DELETE\\node_modules\\#tootallnate',
npm ERR! dest:
npm ERR! 'C:\\Users\\Vaneeza10698\\Downloads\\ServiceQualityFinal\\react-reduction\\node_modules\\npm\\node_modules\\node-gyp\\node_modules\\#tootallnate',
npm ERR! parent: 'npm' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\Vaneeza10698\AppData\Roaming\npm-cache\_logs\2022-02-22T06_28_43_606Z-debug.log
I have done the following so far and still no result
Deleted node_modules and package-lock.json file
npm cache clean --force
npm install --force
Delete node and npm and installed again.
Reboot the system
Check permissions
Turn off firewall
Run cmd as administrator
Node version: 10.23.0
NPM Version: 6.14.8
Any help will be appreciated.
I would try running it on another drive/partition. In the past regardless of my permission set sometimes Windows likes to restrict certain operations such as file name changes even if it's supposed to be allowed in a certain folder. If that doesn't work then try on another computer to see if the problem is related with the system environment or not.
Deleting my node_modules and reinstalling all my used packages helped me fix this error.

NPM - Error: EPERM: operation not permitted, mkdir 'C:\'

New to nodejs and npm. I have installed nodejs and npm using nvm for windows. Now no matter what library I try to install I get:
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\'
npm ERR! [Error: EPERM: operation not permitted, mkdir 'C:\'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\xxxxxx\AppData\Local\npm-cache\_logs\2021-03-03T16_56_40_199Z-debug.log
I've tried clearing the cache, changing the install path, setting the prefix at both the command line and in the config file. Any more suggestions?
Thanks!

npm install -g #vue/cli get error VUE CLI INSTALL ERROR

I'm on PC/Windows 10, node15.0.0, npm 6.14.8
I just wanted to install Vue CLI and I got this error.
I have the latest version of Node.js as you can see below. I tried some different ways like npm uninstall -g vue-cli and npm cache clean --force, but, it did not work.
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\.staging
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\.staging'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\.staging'
npm ERR! },
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\.staging',
npm ERR! parent: '#babel/core'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\lixin yang\AppData\Roaming\npm-cache\_logs\2020-10-31T14_42_05_231Z-debug.log
Any idea what that means and how to solve it?
I found that I could do nothing but press enter
Possible fixes:
open cmd as administrator - search for cmd, right-click, and open as administrator.
run this command npm cache clean --force
npm install again in this administrator cmd.
if still didn't work, close all node processes and try these steps again, also can try these after a system restart.

Node won't install on a fresh project

I want to install npm, after running npm install on a fresh Laravel project I get this errors:
npm WARN deprecated popper.js#1.16.1: You can find the new Popper v2 at #popperjs/core, this package is dedicated to the legacy v1
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:\Users\Andrei Bunea\Desktop\Laravel\Project\node_modules\.staging\errno-1258eed7\.travis.yml
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Andrei Bunea\Desktop\Laravel\Project\node_modules\.staging\errno-1258eed7\.travis.yml'
npm ERR! [Error: EPERM: operation not permitted, unlink 'C:\Users\Andrei Bunea\Desktop\Laravel\Project\node_modules\.staging\errno-1258eed7\.travis.yml'] {
npm ERR! stack: "Error: EPERM: operation not permitted, unlink 'C:\\Users\\Andrei Bunea\\Desktop\\Laravel\\Project\\node_modules\\.staging\\errno-1258eed7\\.travis.yml'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'unlink',
npm ERR! path: 'C:\\Users\\Andrei Bunea\\Desktop\\Laravel\\Project\\node_modules\\.staging\\errno-1258eed7\\.travis.yml'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\Andrei Bunea\AppData\Roaming\npm-cache\_logs\2020-04-25T17_06_43_120Z-debug.log
My npm version is v12.14.0 and my node version is v12.14.0 .
Delete the node_modules folder and package-lock.json file, then run npm install again.
You should run npm command as a super user.
Try,
sudo npm install
If it doesn't make sense try to delete node_modules and try npm install again

Error on npm install gatsby-plugin-styled-components

I am trying to install these npm packages
npm install --save gatsby-plugin-styled-components styled-components babel-plugin-styled-components
I am using node version 10.11.0
However I get the following error, I have tried running it in power-shell in administrator mode made no difference
npm ERR! path C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json'
npm ERR! { [Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\#types\events\npm-shrinkwrap.json'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path:
npm ERR! 'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\#types\\events\\npm-shrinkwrap.json' },
npm ERR! isOperational: true,
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, open \'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\#types\\events\\npm-shrinkwrap.json\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path:
npm ERR! 'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\#types\\events\\npm-shrinkwrap.json',
npm ERR! parent: '#types/glob' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! C:\Users\Anders\AppData\Roaming\npm-cache\_logs\2018-10-20T22_44_07_361Z-debug.log
Remove node_modules
npm cache clean
Try to install again
Should help.

Resources