安装npm软件包时出现权限问题

时间:2020-06-19 06:38:54

标签: npm permissions ubuntu-18.04 adminlte

在安装admin-lte@3.0.5时,出现以下错误:

Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'.

请帮助我解决该权限。

完整错误日志:

ubuntu@ip-XXX-XX-X-XX:/var/www/acceptance$ sudo npm install
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues.
                    Please, upgrade your dependencies to the actual version of core-js@3.

> admin-lte@3.0.5 install /var/www/acceptance/node_modules/admin-lte
> npm run plugins


> admin-lte@3.0.5 plugins /var/www/acceptance/node_modules/admin-lte
> node build/npm/Publish.js -v

Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/bootstrap'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/fontawesome-free'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/fontawesome-free'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/overlayScrollbars'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/overlayScrollbars'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/bootstrap-slider'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/bootstrap-colorpicker'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/bootstrap-colorpicker'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/tempusdominus-bootstrap-4'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/tempusdominus-bootstrap-4'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/moment'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-bs4'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-bs4'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-autofill'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-autofill'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-autofill'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-buttons'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-buttons'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-buttons'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-colreorder'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-colreorder'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-colreorder'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-fixedcolumns'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-fixedcolumns'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-fixedcolumns'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-fixedheader'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-fixedheader'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-fixedheader'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-keytable'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-keytable'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-keytable'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-responsive'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-responsive'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-responsive'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-rowgroup'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-rowgroup'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-rowgroup'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-rowreorder'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-rowreorder'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-rowreorder'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-scroller'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-scroller'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-scroller'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-select'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-select'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/datatables-select'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/jsgrid'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/flag-icon-css'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins/flag-icon-css'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'
Error: Error: EACCES: permission denied, mkdir '/var/www/acceptance/node_modules/admin-lte/plugins'

┌──────────────────────────────────────────────────────────┐
│                 npm update check failed                                                                                             
│           Try running with sudo or get access            
│           to the local update config store via           
│ sudo chown -R $USER:$(id -gn $USER) /home/ubuntu/.config 
└──────────────────────────────────────────────────────────┘

package.json

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.19",
        "bootstrap": "^4.0.0",
        "cross-env": "^7.0",
        "jquery": "^3.2",
        "laravel-mix": "^5.0.1",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "resolve-url-loader": "^3.1.0",
        "sass": "^1.15.2",
        "sass-loader": "^8.0.0",
        "vue-template-compiler": "^2.6.11"
    },
    "dependencies": {
        "admin-lte": "^3.0.5"
    }
}

1 个答案:

答案 0 :(得分:1)

在项目的命令行中运行sudo chown -R $USER:$(id -gn $USER) /home/ubuntu/.config