2016-11-07 23 views
0

我的機器最近從Win 7升級到了Wind 10。我一直在研究一個項目,該項目使用了我設置的一個gulp任務。一旦升級發生的任務開始失敗,我在命令行收到此錯誤:Babel在Windows 10中使用Gulp:不允許操作

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) 

我能夠縮小誤差降至正在與巴別,可能是寫入權限問題,但我有充分的訪問這個特定的項目。如果我從我的gulpfile和package.json中刪除Babel並構建一​​切似乎按預期工作。

這裏的設置我有(只有通天相關項目):

的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 })) 
     ... 
}); 

使用節點U .6.3.0npm v 3.10.3

任何想法或見解,將不勝感激!

回答

2

你說你有這個文件'C:\Users\myuser\.babel.json'完全權限,但錯誤Error: EPERM: operation not permitted, open ...通常指向準確文件權限的問題。

我會再看看文件的屬性頁,並確保該文件沒有被意外標記爲Read Only。 (這可以自動發生,如果你使用某種版本控制你的代碼。)

+1

是的,我有我的項目的權限,但它在我看來我沒有看清楚錯誤,並沒有試圖看着特定的文件。 .babel.json WAS只讀並且調整解決了問題。有時只需要第二雙眼睛看到明顯的:)謝謝! –