node.js - Bitbucket 管道运行 npm 失败

标签 node.js linux bash bitbucket bitbucket-pipelines

我已经为通过 YML 文件运行脚本的 Bitbucket 管道配置了一个 PHP 镜像。我有一个 laravel 存储库,想执行构建命令。

虽然问题是在我的脚本上,当它运行 npm install 时,它失败了。

bash:npm:找不到命令

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.1

pipelines:
  default:
    - step:
        caches:
          - composer
        script:
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install
          - npm install --global gulp-cli
          - npm install
          - gulp --production

最佳答案

这应该有所帮助。它将安装 Node v8 和 NPM v5。放在npm install --global gulp-cli

之前
script:
    - curl -sL https://deb.nodesource.com/setup_8.x | bash -
    - apt-get install -y nodejs

关于node.js - Bitbucket 管道运行 npm 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44815086/

相关文章:

bash - 用于遍历目录的 SSH 命令,除了一些指定的目录

node.js - 在 Windows Azure 上的子文件夹下托管 Ghost 博客的共享链接问题

c++ - 运行后台进程 linux 简单 shell。 C++

linux - grep 不作为正则表达式

linux - Linux Shell 脚本中的动态注释更改

java - 从 Java 在 Linux 上执行 grep 命令总是返回 null

node.js - 浏览器不呈现 Dockerized AngularJS 应用程序

json - vscode调试器找不到模块

node.js - Electron 锻造 : Error: ENOENT: no such file or directory

linux - 读取时显示 "Command Not Found"的 Unix 脚本