Error: EPERM Unable to install #angular/cli - node.js

I have tried to install angular cli with latest version of node as you mentioned. But it is unsuccessful. I have tried it with admin user only
FYI- I have tried it on another machine freshly there also it says the same
OS: windows7 64
node v7.9.0
npm: v4.2.0
error: EPERM: operation not permitted to rename package.json
C:\Windows\system32>npm install -g #angular/cli --save
C:\Users\001091\AppData\Roaming\npm
`-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\#a
ngular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#
1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "#angular/cli" "--save"
npm ERR! node v7.9.0
npm ERR! npm v4.2.0
npm ERR! path C:\Users\001091\AppData\Roaming\npm\node_modules\.staging\url-pars
e-e45d5bd3\package.json.1317145617
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\001091\AppData\
Roaming\npm\node_modules\.staging\url-parse-e45d5bd3\package.json.1317145617' ->
'C:\Users\001091\AppData\Roaming\npm\node_modules\.staging\url-parse-e45d5bd3\p
ackage.json'
npm ERR! { Error: EPERM: operation not permitted, rename 'C:\Users\001091\AppDa
ta\Roaming\npm\node_modules\.staging\url-parse-e45d5bd3\package.json.1317145617'
-> 'C:\Users\001091\AppData\Roaming\npm\node_modules\.staging\url-parse-e45d5bd
3\package.json'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'C:\\Users\\001091\\AppData\\Roaming\\npm\\node_modules\\.stagi
ng\\url-parse-e45d5bd3\\package.json.1317145617',
npm ERR! dest: 'C:\\Users\\001091\\AppData\\Roaming\\npm\\node_modules\\.stagi
ng\\url-parse-e45d5bd3\\package.json',
npm ERR! parent: '#angular/cli' }
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:\Users\001091\AppData\Roaming\npm-cache\_logs\2017-04-26T06_18_55
_108Z-debug.log

Unfortunately, the Angular CLI sometimes has some issues on Windows machines. Please have a look at the following thread for some possible solutions which I tried and worked: https://github.com/angular/angular-cli/issues/1349
Unable to find .angular-cli.DELETE file under C:\Users\\AppData\Roaming\npm\node_modules
hence I have deleted the entire node modules folder and did npm cache clear and then tried. it worked

I had the same issue, so I tried to install it using the node.js command prompt instead of the default one and it worked.
I hope it can help somebody else.

For me the problem was caused by running the npm install in Powershell. Running in a traditional command prompt fixed the issue.

Running Node command prompt as an administrator worked for me.

Try this (for mac users)
sudo chmod -R 777 <project-directory-name>
For example
sudo chmod -R 777 webProject1

Related

npm - EPERM: operation not permitted on Linux

I'm trying to do the react tutorial on my local machine (centOS)
I ran
sudo npm install -g create-react-app
After running that command I got the following error
npm ERR! Linux 3.10.0-514.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "create-react-app"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open '/tmp/npm- 1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz' while getting shasum for /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, open '/tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz' while getting shasum for /tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! at Error (native)
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: '/tmp/npm-1422-84cdbe70/registry.npmjs.org/tar/-/tar-2.2.1.tgz',
npm ERR! parent: 'tar-pack' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
I tried going into the directory and untarring the .tgz file and changing around some of the permissions and nothing worked. I followed some solutions online with similar problems but still no luck.
I also ran
npm cache clear
Can anyone explain why this is happening? Any suggestions?
Running npm cache clear or even npm cache clear -fdoes not always clean all the cache.
Sometimes you should remove the cache files manually.
To do so go to the default NPM cache folder and remove its content:
Default: ~/.npm on linux, or %AppData%/npm-cache on Windows.
Then you can attempt to install your desired package with npm install -g.
Please, avoid using sudo npm install -g because you can mess up the npm permissions. Instead change the permission to npm's default directory, or change npm's default directory to another directory. Further details here:
https://docs.npmjs.com/getting-started/fixing-npm-permissions
WARNING: If npm's default path is just /usr, changing the directory permissions will be harmful.
Try to use $: sudo npm install

How to load the Visual C++ component "VCBuild.exe"?

I tried to run "VCBuild.exe"
My environment:
Windows 10 Pro X64
node v7.9.0-x64
Visual Studio 2017
So,I've just run like this command.
$npm install --global --production windows-build-tools
But it doesn't work.
Errors are bellow:
> windows-build-tools#1.2.1 postinstall C:\Users\Josephine\AppData\Roaming\npm\n ode_modules\windows-build-tools
> node ./lib/index.js
Downloading BuildTools_Full.exe
[> ] 0.0% (0 B/s)
Downloading python-2.7.11.msi
[> ] 0.0% (0 B/s)
Downloaded python-2.7.11.msi. Saved to C:\Users\Josephine\.windows-build-tools\p ython-2.7.11.msi.
Starting installation...
Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".
npm WARN Error: EPERM: operation not permitted, scandir 'C:\Users\Josephine\AppD ata\Roaming\npm\node_modules\windows-build-tools\node_modules'
npm WARN { Error: EPERM: operation not permitted, scandir 'C:\Users\Josephine\A ppData\Roaming\npm\node_modules\windows-build-tools\node_modules'
npm WARN errno: -4048,
npm WARN code: 'EPERM',
npm WARN syscall: 'scandir',
npm WARN path: 'C:\\Users\\Josephine\\AppData\\Roaming\\npm\\node_modules\\win dows-build-tools\\node_modules' }
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\ node_modules\\npm\\bin\\npm-cli.js" "install" "--global" "--production" "windows -build-tools"
npm ERR! node v7.9.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! windows-build-tools#1.2.1 postinstall: `node ./lib/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the windows-build-tools#1.2.1 postinstall script 'node ./lib/ index.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the windows-build-tools p ackage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./lib/index.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs windows-build-tools
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls windows-build-tools
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Josephine\AppData\Roaming\npm-cache\_logs\2017-04-26T17_33 _28_317Z-debug.log
how can i fix them?
The output says exactly what you need to do:
Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".
If you run PowerShell (or the Command Prompt you used to run npm) as Administrator, then it should work.

ionic serve is not working after upgrading node.js and ionic

I upgraded node.js and npm and did an npm install and now I'm getting the message below. The thing is, I have been working on the application for about a year and gulp-sass is installed (it's what I use to upgrade my sass files) so it is clearly do to the upgrade, but I'm not sure how to get everything to work again, sort of downgrading everything again.
$ ionic serve
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'gulp-sass'
Do you need to run `npm install`?
When I try npm install gulp-sass:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\gulp-minify-css\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\karma-junit-reporter\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\karma-mocha-reporter\package.json'
npm WARN rcreditsmobile#1.1.1 No repository field.
npm WARN rcreditsmobile#1.1.1 No license field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Users\\Public\\Programs\\nodejs\\node.exe" "C:\\Users\\Someone\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "gulp-sass" "--save"
npm ERR! node v6.9.5
npm ERR! npm v4.2.0
npm ERR! path E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR! at moveAway (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:42:5)
npm ERR! at destStatted (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:31:7)
npm ERR! at C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR! at moveAway (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:42:5)
npm ERR! at destStatted (C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:31:7)
npm ERR! at C:\Users\Someone\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\node-sass' -> 'E:\xampp\htdocs\cgf\rcredits-mobile\node_modules\.node-sass.DELETE'
npm ERR! at Error (native) parent: 'rcreditsmobile' }
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:\Users\Someone\AppData\Roaming\npm-cache\_logs\2017-02-11T01_17_29_643Z-debug.log
I found an answer on the ionic forum that works, the relevant part is below with a few modifications for clarity:
Just add this to your gulpfile.js
gulp.task('serve:before', ['default']);
That line tells the new ionic 2 client to run the old ionic 1.x client
'default' task before serving (before running ionic serve)
Also you need to add your ionic.config.json file this:
{
...
"app_id": "",
"v2": false,
"typescript": false,
"watch": {
"sass": ["scss/**/*.scss"],
"html": ["www/**/*.html"],
"livereload": [
"www/**/*.html",
"www/**/*.js",
"www/**/*.css"
]
}
...
}
Ref: https://forum.ionicframework.com/t/ionic2-cli-doesnt-run-gulp-tasks-on-ionic-serve/49085/7
I've encountered this problem before. What I've tried so far:
Reinstall the node.js. You may refer https://nodejs.org/en/download/
Run in command line: npm rebuild node-sass
Then try run ionic serve. Hope it helps you.

npm install fails on FAT32 sile system

I'm trying to run npm install in a folder on my FAT32 drive, and this is the error I'm getting:
$ npm install
/work/sites/project
└── (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.8.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path ../semver/bin/semver
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall symlink
npm ERR! Error: EPERM: operation not permitted, symlink '../semver/bin/semver' -> '/work/sites/project/node_modules/accord/node_modules/.bin/semver'
npm ERR! at Error (native)
npm ERR! { Error: EPERM: operation not permitted, symlink '../semver/bin/semver' -> '/work/sites/project/node_modules/accord/node_modules/.bin/semver'
npm ERR! at Error (native)
npm ERR! errno: -1,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'symlink',
npm ERR! path: '../semver/bin/semver',
npm ERR! dest: '/work/sites/project/node_modules/accord/node_modules/.bin/semver',
npm ERR! parent: 'accord' }
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! /work/sites/project/npm-debug.log
npm ERR! code 1
$
So far I understand that the problem is caused by FAT32 not supporting symlinks and/or chmod. But is it really true that there's no work-around for this?
There is an issue open for this on GitHub, where maintainers agree that this is a bug and should be fixed, but the thread has been idle for over a year now.
Also in the same thread user mgiorgino mentions that npm install run under Windows does not make this error. I don't have a chance to confirm this, so is there anyone on Windows who was able to successfully run npm install on a FAT32 file system? If yes, is there any way that we get the same functionality under Linux?
Finally, looking around the web I found FAT32 file system driver and FAT16/FAT32 filesystem implementation packages. Since both their documentation is very scarce, so I can't tell if they can help fix this problem?
Try updating npm by running npm install npm#latest -g. I ran that command and it updated to v4.0.2. The recent updates could contain a fix if it is code related. Command in footer of the npm docs page.
Disabling symlinks helped a number of users when using npm install on systems unable to create symlinks.
To turn off npm using symlinks set bin-links to false in the npm config by running npm config set bin-links false. Optionally you can run npm install --no-bin-links each time. The first command makes the change to the npm config so you don't have to add the --no-bin-links flag each time you run npm install. This is the method recommended in the npm config docs to get npm working on systems/drives that don't support symlinks.

npm install ghost fails with code EPERM errno -4048 syscall rename (on Windows)

During the install of Ghost with npm version 3.8.x, the following errors occur:
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.8
npm WARN Gonzah#0.0.1 No repository field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\aosman\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "ghost"
npm ERR! node v4.3.2
npm ERR! npm v3.8.1
npm ERR! path D:\elastc-app\node_modules\ghost
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'
npm ERR! at moveAway (C:\Users\aosman\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:38:5)
npm ERR! at destStatted (C:\Users\aosman\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:27:7)
npm ERR! at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, rename 'D:\elastc-app\node_modules\ghost' -> 'D:\elastc-app\node_modules\.ghost.DELETE'] parent: 'Gonzah' }
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! D:\elastc-app\npm-debug.log
After searching for a day to figure this out, it's apparently tied to a known bug in npm v3.8 (https://github.com/npm/npm/issues/10379#issuecomment-163316532).
The solution is to temporarily downgrade npm to v2 to perform the install. Do this:
npm uninstall npm -g
npm install npm#2 -g
npm install ghost
Then of course feel free to update npm to the latest version again.

Resources