【问题标题】:Can't run npm install on Ubuntu 20.4 server无法在 Ubuntu 20.4 服务器上运行 npm install
【发布时间】:2022-01-18 17:46:13
【问题描述】:

我有一个 node.js 应用程序,我想在 Ubuntu 20.4 服务器上运行,当我尝试运行命令 npm install 时,我看到以下错误,我在服务器上没有 root 访问权限,这在哪里可以问题是?我有 6.14.3 版本的 npm 和 14.15.3 版本,我该如何处理这个问题?

```
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> core-js@2.6.12 postinstall /var/www/site/public_html/node_modules/@nuxt/babel-preset-app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> core-js@3.10.2 postinstall /var/www/site/public_html/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> bootstrap-vue@2.21.2 postinstall /var/www/site/public_html/node_modules/bootstrap-vue
> opencollective || exit 0

sh: 1: opencollective: Permission denied

> nuxt@2.15.4 postinstall /var/www/site/public_html/node_modules/nuxt
> opencollective || exit 0

sh: 1: opencollective: Permission denied

> swiper@5.4.5 postinstall /var/www/site/public_html/node_modules/swiper
> echo "Love Swiper? Support Vladimir's work by donating or pledging on patreon:
 > https://patreon.com/vladimirkharlampidi
"

Love Swiper? Support Vladimir's work by donating or pledging on patreon:
 > https://patreon.com/vladimirkharlampidi

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1334 packages from 697 contributors and audited 1338 packages in 17.59s

102 packages are looking for funding
  run `npm fund` for details

found 58 vulnerabilities (39 moderate, 18 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
```

【问题讨论】:

    标签: node.js ubuntu npm


    【解决方案1】:

    这可能是权限问题 试试这个

    sudo npm cache clean 
    sudo npm install

    【讨论】:

      猜你喜欢
      • 2022-07-22
      • 2020-02-17
      • 2022-11-11
      • 2020-05-16
      • 1970-01-01
      • 1970-01-01
      • 2017-03-31
      • 2018-04-03
      • 2022-01-22
      相关资源
      最近更新 更多