简体   繁体   English

Github 操作和 npm - npm:找不到命令

[英]Github Actions and npm - npm: command not found

I've created a action for a deployment on github actions.我已经为 github 操作上的部署创建了一个操作。 This all works with composer install and git pulling the master branch.这一切都适用于 composer install 和 git 拉主分支。 However on my digital ocean droplet, I get the issue bash: line 4: npm: command not found If i ssh into my server i can use npm perfectly fine. However on my digital ocean droplet, I get the issue bash: line 4: npm: command not found If i ssh into my server i can use npm perfectly fine. This was installed via nvm and uses the latest version but for some reason its not accessable via the action.这是通过 nvm 安装的并使用最新版本,但由于某种原因,它无法通过操作访问。 My deployment script is我的部署脚本是


on:
  push:
    branches: [master]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy Laravel APP
        uses: appleboy/ssh-action@v0.1.4
        with:
          host: ${{secrets.SSH_HOST}} 
          key: ${{secrets.SSH_KEY}} 
          username: ${{ secrets.SSH_USER }} 

          script: |
            cd /var/www/admin
            git pull origin master
            composer install
            npm install
            npm run prod

I presume this is more to do with the setup from nvm as i can use this via ssh but as they use the same user to log in via ssh, i can't seem to see an issue.我认为这更多地与 nvm 的设置有关,因为我可以通过 ssh 使用它,但由于他们使用同一用户通过 ssh 登录,我似乎看不到问题。

Any ideas how I can resolve this issue to give access/allow github actions to use npm?有什么想法可以解决此问题以提供访问/允许 github 操作以使用 npm?

I didn't find a solution for the nvm issue, installing npm via a different way resoleved this issue.我没有找到 nvm 问题的解决方案,通过不同的方式安装 npm 解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM