如何在Heroku上安装npm

时间:2017-05-11 16:31:42

标签: json node.js heroku laravel-5

我想通过bitbucket-pipeline在Heroku上部署我的应用程序。 流程如下。

  1. composer install
  2. npm install
  3. Laravel-Mix(gulp任务和brouserify等等......)
  4. 这些将是必需的,因为"供应商"和" node_modules"是用gitignore写的。 现在2和3都无法构建。 我想它导致了package.json或bitbucket-pipelines.yml,但我不知道如何编码。请给我解决方案?

    ※已经安装了nodejs buildpack ※当我尝试" heroku运行bash"然后" npm install"

    时,我可以在Heroku应用程序中安装npm

    这是我的" package.json"和" bitbucket-pipelines.yml" (Laravel5.4)

    的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": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "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 --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 --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
      },
      "devDependencies": {
        "axios": "^0.15.3",
        "bootstrap-sass": "^3.3.7",
        "cross-env": "^3.2.3",
        "jquery": "^3.1.1",
        "laravel-mix": "0.*",
        "lodash": "^4.17.4",
        "vue": "^2.1.10"
      }
    }
    

    到位桶-pipelines.yml

    // bitbucket-pipelines.yml
    
    image: phpunit/phpunit:5.0.3
    clone:
      depth: full
    pipelines:
      default:
        - step:
            script: # Modify the commands below to build your repository.
              - composer install
              - npm install
              - npm run production
              - git push https://heroku: test-stg.git HEAD
    

0 个答案:

没有答案