I am stuck with this error no matter what directory I am in, and what I type after "npm" in cmd.exe. Here is the npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: EISDIR: illegal operation on a directory, read
4 verbose stack at Error (native)
5 verbose cwd C:\Users\me
6 error Windows_NT 6.1.7601
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
8 error node v4.2.6
9 error npm v2.14.12
10 error code EISDIR
11 error errno -4068
12 error syscall read
13 error eisdir EISDIR: illegal operation on a directory, read
13 error eisdir This is most likely not a problem with npm itself
13 error eisdir and is related to npm not being able to find a package.json in
13 error eisdir a package you are trying to install.
14 verbose exit [ -4068, true ]
I have tried and uninstalling/reinstalling nodejs multiple times, I even deleted npm and npm-cache folders in C:\Users\me\AppData\Roaming. I'm not sure what went wrong to cause this. One second it was working fine, and now I can't get rid of this error. The explanation in the log does not make sense, as it gives this error in any directory. I should note that running a command prompt as administrator does not give this error. I'm pulling my hair out this Friday evening trying to get this fixed, any help would be greatly appreciated!
This question is related to
node.js
windows
cmd
npm
file-permissions
This happened to me on npm publish --access public
command. Project contained directory named package.json
. This error is sad - because project HAS to have this directory and named exactly package.json
(it was part of test case fixture to assert correct behavior of this lib).
Had the same problem today after i've upgraded my npm from version 6.4.1 to version 6.5.0. I fixed this by downloading the .pkg installer (recommended for most users) from node.js and runned it afterwards.
EISDIR stands for "Error, Is Directory". This means that NPM is trying to do something to a file but it is a directory. In your case, NPM is trying to "read" a file which is a directory (Line: 4). Since the operation cannot be done the error is thrown.
Three things to make sure here.
In my case I forgot to pass the full path of one of the file it was asking. After passing full path of the file worked :)
Just delete .npmrc folder in c:users>'username' and try running the command it will be resolved !
In my case issue was that space
character was in the name of the source folder (Windows 10).
These strange errors occured recently on my OSX machine.
I could help myself the quick & dirty way by running:
sudo chmod -R 777 /usr/local/lib/node_modules/
Something seemed to have messed up the access rights of all global node modules.
Make sure to check your version of npm and whether or not there are issues with it. I was having the same issue at the time of this post and I discovered that my npm version (6.5) was having issues. I had to uninstall and reinstall npm version 6.4.1 and then everything started to work great again.
I had faced similar issue. I set cafile using the command:
npm config set cafile PATH_TO_CERTIFICATE
I was able to resolve this by deleting the certificate file settings, and setting strict-ssl = false
.
For mac os: If installed directly from nodejs website the npmrc file would be located in /usr/local/etc/npmrc. Just delete the config which is undefined and this problem would be fixed.
I had a broken symlink to node_modules in a subfolder
Had the same problem until I tried deleting the .git folder. It worked. I guess this type of problem can have different causes.
I had a similar problem while setting up boilerplate code. It was reading my bundle.js file as a directory. So as stated here. EISDIR mean its a directory and not a file. To fix the issue, I deleted the file and just recreated (it was originally created automatically). If you cannot find the file (because its hidden), simply use the terminal to find and delete it.
In my case, i was facing this issue while installing create-react-app
in MAC (Mojave OS)
with following command :
sudo npm install create-react-app -g
and got errors like this :
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/src/scheduler'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/src/symbol'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/src/testing'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/src/util'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/src/webSocket'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/symbol'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/testing'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/util'
npm WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/.staging/rxjs-a84420a7/webSocket'
I have read npm.community that try to install without sudo
:
npm install create-react-app -g
and it actually solved my issue ..!!
In my case I was getting the "EISDIR: illegal operation on a directory, read" because in my .angular-cli.json file I wasn't providing a full path in "scripts:"
For example I had
"scripts": [
"../node_modules/hammerjs",
"../node_modules/moment"
],
In fact it should have been
"scripts": [
"../node_modules/hammerjs/hammer.min.js",
"../node_modules/moment/min/moment.min.js"
],
In my case, I am working on angularv10 with material. I had changed some script files and forgot to remove these empty "" in the scripts array
scripts: [.....bla, bla, etc, ""]
remove these empty""
npm clear-cache --force
close and open vscode
It worked.
Check to ensure you are running npm install from the proper directory.
(The package.json file could be one extra directory down, for example.)
In my case, I'm using Windows 10 in Spanish and this version mixes English and Spanish directory names. My problem was that the desktop directory has this name for some commands and escritorio
to others. I believe that npm cannot resolve this. My solution was to simply change to another directory starting from C:\ different to my home directory.
I just removed the line
.babel('resources/assets/js/app.js')
for laravel 5.6 with vue.js. in webpack.mix.js
Make sure node_modules (and your root package.json) doesn't contain a reference to npm's "package.json" module. Deleting package.json FOLDER from node_modules solved the issue for me.
I had the same issue on Mac OS X (installed with homebrew), and the .npmrc is not the only place node stored config variables. There is a glocal npmrc config file in /usr/local/etc that you have to edit using this command:
sudo nano npmrc
Remove the ca=
line, or whatever the config setting was that broke your install, save that file, and try npm again, and you should see it working.
I had the same issue. There was a linked folder in my directory which was causing the issue. i added that folder to ignore list and then it started working fine as expected.
On Mac:
Per-user config file: ~/.npmrc
In my case, the C:\Users\{user}\AppData\local\npm
files were hidden, so I was not able to find & delete the trouble directory. Took me DAYS to realize this!
So double check to un-hide any folders so you don't miss them! Here's a link to do this if you don't know how.
I had this issue with gulp. The problem was that gulp added a dependency to my source file and I think npm tried to open it:
{
"name": "name",
"version": "2.0.0",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"appname": "file://gulp",
"gulp-concat": "^2.6.1",
"gulp-electron": "^0.1.3",
"gulp-shell": "^0.5.2",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"node-7z": "^0.4.0"
}
}
Make sure that there are no strange references in you package.json file.
If your problem is associated with the React Native packager. Try resetting the cache with react-native start --reset-cache
.
For me fixing was add slash after directory name
In my case these steps solved my problem:
npm
process (CTRL + C)
npm
againI fixed this issue by moving my directory from my exFAT drive which does not support symlinking.
My exFat drive is shared between osx and a bootcamp windows partition so when I tried to clone and npm install my project it was failing but never explains that exFAT doesn't support this functionality.
There are drivers out there that you can install to add the ability to symlink but you'll have to do a lot of your setup manually compared to running a simple npm script.
I know this isn't specifically asking about forever js.. but google lead me here so.. For me it was as simple as an ending slash.
I just changed:
forever start -a -l /dev/null/ /var/www/node/my_file.js
To:
forever start -a -l /dev/null /var/www/node/my_file.js
And the error disappeared
Doing a complete uninstall, including removing paths, etc and reinstalling has solved the problem, very strange problem though.
Source: Stackoverflow.com