2016-12-27 6 views
0

私は私のHerokuインスタンス上CSSjsファイルを最小限に抑えるために、私はlessをインストールすることはできませんcompressdjango compressor)を実行しようとしています。

ビルド進捗ログ

-----> Node.js app detected 
-----> Creating runtime environment 

     NPM_CONFIG_LOGLEVEL=error 
     NPM_CONFIG_PRODUCTION=true 
     NODE_ENV=production 
     NODE_MODULES_CACHE=true 
-----> Installing binaries 
     engines.node (package.json): 4.1.1 
     engines.npm (package.json): unspecified (use default) 

     Downloading and installing node 4.1.1... 
     Using default npm version: 2.14.4 
-----> Restoring cache 
     Loading 2 from cacheDirectories (default): 
     - node_modules (not cached - skipping) 
     - bower_components (not cached - skipping) 
-----> Building dependencies 
     Installing node modules (package.json) 
-----> Caching build 
     Clearing previous node cache 
     Saving 2 cacheDirectories (default): 
     - node_modules (nothing to cache) 
     - bower_components (nothing to cache) 
-----> Build succeeded! 
     └── (empty) 

-----> Python app detected 
    $ pip install -r requirements.txt 
-----> Running post-compile hook 
npm http GET https://registry.npmjs.org/less 
npm http 200 https://registry.npmjs.org/less 
npm http GET https://registry.npmjs.org/less/-/less-2.7.1.tgz 
npm http 200 https://registry.npmjs.org/less/-/less-2.7.1.tgz 
npm WARN engine [email protected]: wanted: {"node":">=0.12"} (current: {"node":"v0.8.12","npm":"1.1.63"}) 
npm http GET https://registry.npmjs.org/errno 
npm http GET https://registry.npmjs.org/graceful-fs 
npm http GET https://registry.npmjs.org/image-size 
npm http GET https://registry.npmjs.org/mime 
npm http GET https://registry.npmjs.org/mkdirp 
npm http GET https://registry.npmjs.org/promise 
npm http GET https://registry.npmjs.org/source-map 
npm http 200 https://registry.npmjs.org/mkdirp 
npm http 200 https://registry.npmjs.org/mime 
npm http 200 https://registry.npmjs.org/image-size 
npm http 200 https://registry.npmjs.org/graceful-fs 
npm WARN optional dep failed, continuing [email protected]^0.5.0 
npm WARN optional dep failed, continuing [email protected]^1.2.11 
npm WARN optional dep failed, continuing [email protected]^4.1.2 
npm http GET https://registry.npmjs.org/image-size/-/image-size-0.5.1.tgz 
npm http 200 https://registry.npmjs.org/source-map 
npm WARN optional dep failed, continuing [email protected]^0.5.3 
npm http 200 https://registry.npmjs.org/image-size/-/image-size-0.5.1.tgz 
npm http 200 https://registry.npmjs.org/errno 
npm WARN optional dep failed, continuing [email protected]^0.1.1 
npm http 200 https://registry.npmjs.org/promise 
npm WARN optional dep failed, continuing [email protected]^7.1.1 
npm WARN engine [email protected]: wanted: {"node":">=0.10.0"} (current: {"node":"v0.8.12","npm":"1.1.63"}) 
[email protected] node_modules/less 
└── [email protected] 
-----> Discovering process types 
     Procfile declares types -> web 
-----> Compressing... 
     Done: 72.8M 
-----> Launching... 
     Released v159 
     https://<my-app>.herokuapp.com/ deployed to Heroku 

package.json

{ 
    "name": "myapp", 
    "description": "a really cool test", 
    "version": "1.0.0", 
    "engines": { 
    "node": "4.1.1" 
    } 
} 

post_compileフック

#!/usr/bin/env bash 
export PATH=/app/.heroku/node/bin:$PATH 
npm install less 

なぜこれが機能しないのですか? Node.jsの正しいバージョンがインストールされているようですが、何とかして$PATHから削除されます。私は$PATHが複数のビルドパック間で永続的ではないと推測しています。何か案は?

答えて

0

post_compileフックにlessをインストールしようとしている理由がわかりません。 はなぜだけではなく、Herokuのにプッシュ(開発環境で)次のコマンドを実行して、あなたのGitのリポジトリに変更package.jsonを追加することによって、あなたのpackage.jsonに直接追加:

npm install less --save 
+0

はい、それだろう私の次のステップですが、$ PATHがビルドパック間でリセットされるように見えるので、私は$ PATHに正しいノードバージョンを取得することさえできないので、これについてあまり楽観的ではありません。おかげで試してみる – intelis

+0

pythonビルドパックがあなたのノード環境を台無しにしているのであれば、buildpacksの順番を逆にすることができます(つまり、Pythonビルドパックを最初にロードし、次にノードbuidpackをロードする)。 https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app#setting-a-buildpackを参照してください。 –