You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

npm install遇closure-util权限拒绝问题求助(含OpenLayers环境)

Fixing "closure-util: Permission denied" When Installing OpenLayers

Looks like the issue here isn't tied to your proxy configuration—this is a permission error when npm tries to execute the closure-util update script. Let's go through actionable fixes to get this sorted:

  • Reset local dependencies with safe permissions
    First, clear out your existing node_modules and lock file, then reinstall with a flag that ensures script execution permissions:

    rm -rf node_modules package-lock.json
    npm install --unsafe-perm
    

    The --unsafe-perm flag bypasses permission restrictions for script runs, which is often necessary when packages need to execute setup scripts like closure-util update.

  • Fix global npm directory permissions
    If your global npm packages have incorrect ownership, it can cause permission issues even for local installs. Run these commands to ensure your user owns the global npm directories:

    sudo chown -R $USER:$GROUP ~/.npm
    sudo chown -R $USER:$GROUP $(npm config get prefix)
    

    After this, you can try reinstalling closure-util globally first, then running your local install again:

    npm install -g closure-util
    npm install
    
  • Add execution permissions directly to closure-util
    If the problem is specifically that the closure-util binary lacks execute rights, navigate to your project directory and run:

    chmod +x node_modules/.bin/closure-util
    

    Then try running the update script manually to verify:

    npx closure-util update
    
  • Avoid using sudo for npm installs
    Using sudo to run npm install often messes up file ownership in node_modules and your global npm folder. If you previously used sudo to install packages, fix your project directory permissions first:

    sudo chown -R $USER:$GROUP ./
    

    Then reinstall without sudo.

内容的提问来源于stack exchange,提问作者Priya Mani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 06:41:08