Webpack Bundle Analyzer,拒绝在光盘上写入的权限

时间:2018-07-11 09:22:00

标签: webpack ubuntu-18.04 webpack-bundle-analyzer

尝试:

new BundleAnalyzerPlugin({
  analyzerMode: "static",
  openAnalyzer: false
})

具有磁盘写权限失败(与禁用模式相同,带有静态文件)。我正在使用Ubuntu 18,是否可以设置该软件包,以便它对我和其他任何用户有效? (与Op sys无关) 如果没有,怎么解决?

return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/report.html'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at /home/yaniv/Jeeng-Workspace/sdk/node_modules/webpack-bundle-analyzer/lib/viewer.js:160:8
    at tryHandleCache (/home/yaniv/Jeeng-Workspace/sdk/node_modules/ejs/lib/ejs.js:257:5)
    at Object.exports.renderFile (/home/yaniv/Jeeng-Workspace/sdk/node_modules/ejs/lib/ejs.js:482:10)
    at Object.generateReport (/home/yaniv/Jeeng-Workspace/sdk/node_modules/webpack-bundle-analyzer/lib/viewer.js:149:7)
    at BundleAnalyzerPlugin.generateStaticReport (/home/yaniv/Jeeng-Workspace/sdk/node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:149:14)
    at /home/yaniv/Jeeng-Workspace/sdk/node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:72:26
    at /home/yaniv/Jeeng-Workspace/sdk/node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:80:22
    at Array.forEach (<anonymous>)
    at Immediate._onImmediate (/home/yaniv/Jeeng-Workspace/sdk/node_modules/webpack-bundle-analyzer/lib/BundleAnalyzerPlugin.js:79:21)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jeeng-sdk@1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jeeng-sdk@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!     /home/yaniv/.npm/_logs/2018-07-11T09_14_00_211Z-debug.log

1 个答案:

答案 0 :(得分:0)

必须更改为相对路径“ ./report.html” :) (以免写在root ubuntu上)