Deploying webapp using grunt on heroku not working - heroku

I have added, grunt registerTask 'heroku' task to the Gruntfile.js file. But on doing git commit and git push heroku master, in the end I am getting this error. Kindly help me out here.
-----> Found Gruntfile, running grunt heroku:production task
Loading "Gruntfile.js" tasks...ERROR
Error: Cannot find module 'load-grunt-tasks'
Warning: Task "heroku:production" not found. Use --force to continue.
grunt.registerTask('heroku',[
'clean:dist',
'useminPrepare',
'concurrent:dist',
'compass:dist',
'autoprefixer',
'concat',
'imagemin',
'cssmin',
'uglify',
'modernizr',
'usemin',
'htmlmin'
]);

I've ran into the same problem yesterday.
You need to add load-grunt-tasks to your dependencies in package.json, not your devDependencies. Also, make sure your task is called heroku:production, as that is what the error clearly states.

Related

parcel build error: plugin is not a function

I am trying to build a simple web project
project structure like this
-src
--index.html
--index.js
--style.css
package.json
yarn.lock
I installed parcel-bundler with this
yarn global add parcel-bundler
And I run the parcel build command
parcel build src/index.html
But error has occurred followed by this log
D:\playground\js\sample>parcel build src/index.html
× D:\playground\js\sample\src\style.css:undefined:undefined: plugin is not a function
at LazyResult.run (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:288:14)
at LazyResult.asyncTick (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:212:26)
at C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:254:14
at new Promise (<anonymous>)
at LazyResult.async (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:250:23)
at LazyResult.then (C:\Users\pc\AppData\Roaming\nvm\v15.14.0\node_modules\parcel-bundler\node_modules\postcss\lib\lazy-result.js:131:17)
I'm just following the instruction of parcel's official docs
I cannot find a solution
please help me
Try --no-minify
Why is the accepted answer, "throw out the baby with the bathwater?"
parcel-bundler does still work, but instead of fixing what's broken, it's been abandoned for Parcel 2, which DOES NOT support Vue 2 SFCs.
Building a Rails 6/Vue 2 app and converting to parcel from webpack(er), so Parcel 2 is not an option for me. (Demanding people upgrade, and then not providing an upgrade path or decent docs, reminds me too much of webpack!)
parcel build ./app/packs/entrypoints/*.js --no-minify
This disables minification, which at least eliminates this particular error for me.
Problem solved: parcel-bundler is deprecated. Use 'parcel' not 'parcel-bundler'
package.json
If you have preset the scripts...
"scripts": {
"start": "parcel index.html",
"dev": "parcel index.html",
"build": "parcel build index.html"
},
...simply run
npm run build
otherwise use this syntax:
npm run build index.html
Replace index.html to whatever file you want to build, but make sure it is the same type of file.

How to successfully run elm-coverage?

I try to configure elm-coverage to be used in CI.
Installation was successful, installed using yarn as "elm-coverage": "0.2.0"
Our most recent command for running tests is
./node_modules/.bin/elm-test --compiler ./node_modules/.bin/elm app/frontend/elm/tests/
app/frontend/ is there, because elm app is within repository of rails app.
When I try to use coverage
elm-coverage --elm-test ./node_modules/.bin/elm-test -- --compiler ./node_modules/.bin/elm app/frontend/elm/tests/
in (ruby app's) root, it returns
MacBook-Pro-6:enectiva admin$ elm-coverage --elm-test ./node_modules/.bin/elm-test -- --compiler ./node_modules/.bin/elm app/frontend/elm/tests/
/Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:33
throw err;
^
Error: does not exist.
at Object.notExist (/Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:41:12)
at traverseAsync (/Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:163:28)
at /Users/admin/git.enectiva.cz/enectiva/node_modules/elm-coverage/node_modules/find/index.js:282:7
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Otherwise, I tried
MacBook-Pro-6:enectiva admin$ elm-coverage app/frontend/elm/tests/ --elm-test ./node_modules/.bin/elm-test
[12:57:01.68] Instrumenting sources...
[12:57:01.89] Something went wrong:
I searched through issues in Github repository, it does not seem to be reported bug, so there must be something I missed.
Does anyone know, how to actually use it?
OK, I've had a bit more of a play with elm-coverage, as I've been able to get it to run on an Elm project of mine.
Firstly elm-coverage has a --verbose flag which adds extra logging, so try running with that.
I've had best results if I cd to the folder containing my elm.json file and run elm-coverage from there. In your case, this would look something like the following:
cd app/frontend/elm && elm-coverage [source folder] --elm-test ../../../node_modules/.bin/elm-test
[source folder] is the name of the folder containing your source files (not the tests). For me, [source folder] is src, but because that's the default I can omit it.

Run lint on golang repo in travis

I run locally on my project the following command
gometalinter --config=gometalinter.json ./...
at the beginning I got some errors and I was fixed them all!
now I run the same command exaclty in Travis script
and I got vendor errros like
vendor/github.com/spf13/viper/flags.go:3:8:warning: error return value not checked (could not import github.com/spf13/pflag (go/build: importGo github.com/spf13/pflag: exit status 1) (errcheck)
vendor/github.com/spf13/viper/viper.go:42:7:warning: error return value not checked (could not import github.com/pelletier/go-toml (go/build: importGo github.com/pelletier/go-toml: exit status 1) (errcheck)
This is the gometalinter.json for the config
{
"vendor": true,
"Deadline": "2m",
"Sort": [
"linter",
"severity"
],
"DisableAll": true,
"Enable": [
"gotypex",
"vetshadow",
"errcheck",
"gocyclo",
"vet",
"golint",
"vetshadow",
"ineffassign",
],
"Cyclo": 10,
"LineLength": 120
}
I dont understand why locally I dont get this error (i've the vendor repo) and why it ask for vendor error ? what could be the reason ?
gometalinter runs binaries in your path to do its check. I have had problems where my CI would have one set of binaries versions while my local development environment would have different versions.
Try updating all the required binaries on your local machine.
Try --vendor flag and check versions of gometalinter and all used linters.
Extract from gometalinter documentation:
How do I make gometalinter work with Go 1.5 vendoring?
gometalinter has a --vendor flag that just sets
GO15VENDOREXPERIMENT=1, however the underlying tools must support it.
Ensure that all of the linters are up to date and built with Go 1.5
(gometalinter --install --force) then run gometalinter --vendor ..
That should be it.

Heroku release phase bundle not found

I have the following release phase in my Procfile:
release: bundle exec rake db:migrate
It works great when I merge PR's into my staging and production apps, but it fails when running on a new review app. The Heroku docs say that the release phase is run after a successful build, so I don't know why it can't find bundle.
This is my output
heroku releases:output 9 --app my-app-pr-253
/bin/sh: 1: bundle: not found
For Heroku's review apps, you must specify all buildpacks and ENV vars you need in the app.json file. You can either manually create one, or have Heroku generate one for you.
https://devcenter.heroku.com/articles/github-integration-review-apps#app-json
Confirm that in your app.json you have specified
1) The required buildpacks https://devcenter.heroku.com/changelog-items/670. Since you are using bundle I'm guessing heroku/ruby will be one. Below is an example.
"buildpacks": [
{
"url": "https://github.com/heroku/heroku-buildpack-ruby.git"
},
2) Also make sure you specify any config variables that you want to inherit from the app off which your review app is being built. https://devcenter.heroku.com/articles/app-json-schema#env Missing one of these could also be causing a build to fail.
If neither of these work, try checking the logs for your heroku app. Watch the ones in the Heroku GUI during the build. Also try to tail the logs in the CLI.
heroku logs -t -a <review_app_name>
I figured out my problem. It was a silly typo:
"buildpacks": [
{
"url": "heroku/ruby",
"url": "https://github.com/guillaume-tgl/heroku-buildpack-ghostscript.git"
}
]
should have been:
"buildpacks": [
{ "url": "heroku/ruby"},
{ "url": "https://github.com/guillaume-tgl/heroku-buildpack-ghostscript.git" }
]

Gulp.watch will not keep watching files.

I have the following code,
http://paste.ubuntu.com/6824071/
but when I run 'gulp' in cli it just runs the tasks and quits. It dosen't stay to watch the files and recompile.
Ezras-MacBook-Air:no1fitness-sandbox Ezra$ gulp
[gulp] Using file /www/no1fitness-sandbox/gulpfile.js
[gulp] Working directory changed to /www/no1fitness-sandbox
[gulp] Running 'default'...
gulp.run() has been deprecated. Use task dependencies or gulp.watch task triggering instead.
[gulp] Running 'styles'...
[gulp] Finished 'default' in 8.2 ms
[gulp] Finished 'styles' in 1.85 s
Ezras-MacBook-Air:no1fitness-sandbox Ezra$
The only way I can make it do it is by removing the task around the gulp.watch function.
is this right? Are there better ways (that work)?
Then theres the warning about gulp.run, which I'm confused about as their own docs still seem to use it.
You aren't calling the watch task — you are running the default task:
[gulp] Running 'default'...
Run gulp watch to run your watch task.
I know that the question was answered right, but this post comes from Google while I was searching for my problem and the solution in my case is:
npm install gulp-watch
Hope this saves someone else time ^^
Another cause could be that the directory to watch does not contains any file. In that case 'gulp watch' stops immediately.

Resources