webstorm上導入了react項目,執行npm run start 之后就報錯,
> cross-env APP_TYPE=site umi dev
fs.js:114
throw err;
^
Error: EPERM: operation not permitted, open 'path\node_modules\.cache\@babel\register\.babel.7.2.2.development.json'
at Object.openSync (fs.js:443:3)
at Object.writeFileSync (fs.js:1194:35)
at save (path\node_modules\@babel\register\lib\cache.js:52:15)
at process._tickCallback (internal/process/next_tick.js:61:11)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! unifast-react@1.0.0 start: `cross-env APP_TYPE=site umi dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the unifast-react@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Program Files\nodejs\node_cache\_logs\2019-06-14T07_34_39_651Z-debug.log
Process finished with exit code 1
看錯誤信息是要寫某個文件時沒有權限,這時根據路徑過去看下是個隱藏文件,打開看一下只有一對“{}”,
網上能搜到的方法一般都是用管理員權限去運行“命令行”,這時候發現沒用,
然后有的提到讓修改整個項目文件夾的屬性,給當前用戶添加修改權限,也沒用,
最后可以試下給這個.babel.7.2.2.development.json文件重命名一下,加個“_bak”后綴,然后再去webstorm中運行一下,
此時可以正常編譯運行了,