Stu Furlong Stu Furlong - 26 days ago 14
Javascript Question

Babel on Gulp in Windows 10 : Operation not permitted

My machine was recently upgraded from Win 7 to Wind 10. I've been working on a project that utilizes a gulp task I set up. Once the upgrade took place the task started failing and I received this error in the command line:

return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EPERM: operation not permitted, open 'C:\Users\myuser\.babel.json'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.writeFileSync (fs.js:1333:33)
at save (C:\Users\myuser\Desktop\project\node_modules\babel-register\lib\cache.js:45:16)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)


I was able to narrow the error down to being related to Babel, and possibly a write permissions issue but I have full access to this particular project. If I remove Babel from my gulpfile and package.json and build everything seems to work as expected.

Here's the setup I have (only babel related items):

Package.json

"devDependencies": {
"babel-core": "^6.14.0",
"babel-preset-es2015": "^6.14.0",
"gulp-babel": "^6.1.2",
...
}


Gulpfile.babel.js

...
const babel = require('gulp-babel'),
...

gulp.task('scripts', function() {
return gulp.src(['/js/**'])
...
.pipe(babel({ compact:false }))
...
});


Using Node v.6.3.0 and npm v 3.10.3

Any thoughts or insights would be appreciated!

Answer

You say you have full permissions for this file 'C:\Users\myuser\.babel.json', but the error Error: EPERM: operation not permitted, open ... for me usually points exactly to a file permission issue.

I'd look again at the file's Properties page, and make sure the file hasn't accidentally been marked as Read Only. (This can happen automatically if you use some sort of version control for your code.)

Comments