jit-grunt: Plugin for the "watch" task not found - node.js

after executing >> "grunt server" i saw these errors i don't know what and where i need to attach or detach some code.
one more thing DeprecationWarning: while nowhere in the code i wrote node --debug and node --debug-brk.
$ grunt server
Running "server" task
>> The `server` task has been deprecated. Use `grunt serve` to start a server.
Running "serve" task
Running "clean:server" (clean) task
>> 0 paths cleaned.
Running "env:all" (env) task
Running "express:dev" (express) task
Starting background Express server
(node:5497) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.
Stopping Express server
Running "wait" task
>> Waiting for server reload...
Done waiting!
jit-grunt: Plugin for the "watch" task not found.
If you have installed the plugin already, please setting the static mapping.
See https://github.com/shootaroo/jit-grunt#static-mappings
Warning: Task "watch" failed. Use --force to continue.
Aborted due to warnings.
Execution Time (2018-09-25 12:24:48 UTC+5:30)
loading tasks 124ms ▇▇▇▇ 7%
express:dev 106ms ▇▇▇ 6%
wait 1.5s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 85%
Total 1.8s
Solution
npm install grunt-contrib --save-dev
and add this line before the last line of grunt.js:
grunt.loadNpmTasks('grunt-contrib');

Related

error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`. in Mac

I am setting up an Android development environment. However, there is a problem in the execution environment. I've already finished the configuration, but I keep saying I can't find the device. However, if you run the server and then run it in the Android studio, it will work normally. What's the problem?
bash_profile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home
export PATH=${PATH}:$JAVA_HOME/bin
export ANDROID_PATH=/Users/myname/Library/Android
export PATH=$PATH:$ANDROID_PATH/sdk/platform-tools
export PATH=$PATH:$ANDROID_PATH/sdk/emulator
export PATH=$PATH:$ANDROID_PATH/sdk/tools
export PATH=$PATH:$ANDROID_PATH/sdk/tools/bin
But Error
$ npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
/bin/sh: adb: command not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
Starting a Gradle Daemon, 5 stopped Daemons could not be reused, use --status for details
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug
> Task :app:installDebug FAILED
27 actionable tasks: 9 executed, 18 up-to-date
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 22s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
[adb]: * daemon not running; starting now at tcp:5037
[adb]: * daemon started successfully
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 22s
at checkExecSyncError (child_process.js:611:11)
at execFileSync (child_process.js:629:15)
at runOnAllDevices (/Users/myname/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Is there anyone who has the same problem as me?
Try the following:
> vim ~/.bash_profile
Add the following lines:
export ANDROID_HOME=/Users/myname/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_PATH/emulator
export PATH=$PATH:$ANDROID_PATH/tools/bin
Save changes and restart terminal.
Run ADB and if you got following it will work.
> adb devices
List of devices attached
emulator-5554 device
If you already configured the .bash_profile check the ANDROID_HOME using echo and then you simply need to run your app with this command :
source ~/.bash_profile && npx react-native run-android
UPDATE
Pay attention to this : You should run bash shell NOT zsh shell to be able to run emulator.

Bluemix push error

i'm getting an error when I try to push to BlueMix from local.
> node lib/install.js
> optipng-bin#3.1.4 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-optipng/node_modules/optipng-bin
✔ optipng pre-build test passed successfully
> pngquant-bin#3.1.1 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-pngquant/node_modules/pngquant-bin
> node lib/install.js
✔ pngquant pre-build test passed successfully
> gifsicle#3.0.4 postinstall /tmp/app/node_modules/img-loader/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js
✔ gifsicle pre-build test passed successfully
/tmp/buildpacks/cbed2b9b0603a1febfaafeebb556dd0b/lib/dependencies.sh: line 1: 163 Killed npm install --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
-----> Build failed
Failed to compile droplet
Check our support community to get help on common issues:
http://ibm.biz/bluemixcommunitysupport
If you need additional help and your subscription includes support, submit a ticket so we can help:
http://ibm.biz/bluemixsupport
Exit status 223
Staging failed: Exited with status 223 (out of memory)
Destroying container
Successfully destroyed container
FAILED
Error restarting application: StagingError
It works great locally. I tried increasing memory to 1GB, didn't help either. Please help.

MEAN app - no logs

I have an application running on a node server. The application is running fine, but unfortunately I do not see any logs in the terminal window. When I do npm start, I get the following output in the terminal:
> app#0.1.0 start /Users/prerak/WebProjects/app/www
> grunt
Running "jshint:all" (jshint) task
Running "csslint:all" (csslint) task
Warning: Unable to read ".csslintrc" file (Error code: ENOENT). Used --force, continuing.
Running "concurrent:default" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views/**/*.* gruntfile.js server.js config/**/*.js app/**/*.js
[nodemon] starting `node --debug server.js`
I have some calls to console.log in my server.js file but I do not see them in the terminal. Is there anything else that I can do to get the logs?
For the application without any errors it's fine but if there are any issues, it's very difficult to debug the issue. In case of an error, I get the following in the logs:
> app#0.1.0 start /Users/prerak/WebProjects/app/www
> grunt
Running "jshint:all" (jshint) task
Running "csslint:all" (csslint) task
Warning: Unable to read ".csslintrc" file (Error code: ENOENT). Used --force, continuing.
Running "concurrent:default" (concurrent) task
Running "nodemon:dev" (nodemon) task
Running "watch" task
Waiting...
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: app/views/**/*.* gruntfile.js server.js config/**/*.js app/**/*.js
[nodemon] starting `node --debug server.js
[nodemon] app crashed - waiting for file changes before starting...
I do not get any stackstace of the issue.
I have also configured my express server to show the stacktrace as:
var app = express();
app.set('showStackError', true);
I have this issue on Mac OSX 10.12 but if I run the same code on Ubuntu 14.10, it shows the logs in the terminal.
Also, instead of npm start if I do node server.js it shows the logs. What can be the reason behind this?

EPERM during gulp commands

I have a gulpfile that I am using together with Browserify, Babelify and BrowserSync to implement my build workflow. However, I am constantly having problems with EPERM errors in Node.js.
I first had an error in my gulp clean task that used rimraf in order to clean my dist directory. The task would occasionaly throw an error (I was not able to reproduce the error 100% of attempts though). The error was an EPERM that complained about the unlink action for ./dist/app.js. I tried using del instead of rimraf and for some reason it helped.
However, if I run gulp watch and something changes , there is very often this error now:
(node:10740) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[22:52:35] Using gulpfile D:\Workspace\milestones\gulpfile.js
[22:52:35] Starting 'clean'...
[22:52:35] Finished 'clean' after 4.2 ms
[22:52:35] Starting 'build-persistent'...
[22:52:37] Finished 'build-persistent' after 1.55 s
[22:52:37] Starting 'watch'...
[22:52:37] Finished 'watch' after 92 ms
[BS] Local URL: http://localhost:3000
[BS] External URL: http://192.168.0.108:3000
[BS] Serving files from: ./
[22:52:48] Starting 'clean'...
[22:52:48] Finished 'clean' after 2.77 ms
[22:52:48] Starting 'build-persistent'...
stream.js:74
throw er; // Unhandled stream error in pipe.
^
Error: EPERM: operation not permitted, open 'D:\Workspace\milestones\dist\app.js'
at Error (native)
The full gulpfile may be seen in the gist here.
I am running Windows 10.
Update: The issue seems to be absent when running gulp build and therefore might be caused by BrowserSync.

How do you debug nodejs projects?

For the past 16 hours or so, I've been trying to get a MEAN stack project working on my computer.
I started with the Yeoman angular-fullstack project. But that was giving me all kinds of errors so I just gave up on it.
Then I followed some tutorials which helped me get started but didn't cover a ot of my questions.
Then I found mean.io which offers a full boilerplate MEAN stack project, which I followed the instructions to set up. Unfortunately, when I try to run it, I get all kinds of errors again :-(
The worst part about is, that it says NOTHING about what/where is causing the error.
Can someone help me figure it out? Please :-)
The latest error I'm getting is when I run grunt.
C:\Users\Imray\projects Practice\meanIO\meanApp>grunt
Running "hook" task
>> Starting hooked tasks.
Running "clean:0" (clean) task
>> 0 paths cleaned.
Running "jshint:all" (jshint) task
>> 42 files lint free.
Running "csslint:src" (csslint) task
>> 5 files lint free.
Running "concurrent:tasks" (concurrent) task
Running "watch" task
Waiting...
Running "nodemon:dev" (nodemon) task
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node --debug server.js`
debugger listening on port 5858
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1042:14)
at listen (net.js:1064:10)
at Server.listen (net.js:1138:5)
at ExpressEngine.beginBootstrap (C:\Users\Imray\projects Practice\meanIO\meanApp\node_modules\meanio\lib\core_modules\server\E
xpressEngine.js:123:14)
at Meanio.serveWithDb (C:\Users\Imray\projects Practice\meanIO\meanApp\node_modules\meanio\lib\core_modules\server\index.js:14
:10)
at Consumer.Dependable.runAction (C:\Users\Imray\projects Practice\meanIO\meanApp\node_modules\meanio\node_modules\lazy-depend
able\index.js:72:22)
at Consumer.Dependable.fire (C:\Users\Imray\projects Practice\meanIO\meanApp\node_modules\meanio\node_modules\lazy-dependable\
index.js:69:53)
at Consumer.onResolved (C:\Users\Imray\projects Practice\meanIO\meanApp\node_modules\meanio\node_modules\lazy-dependable\index
.js:119:8)
at Consumer.Dependable.resolve (C:\Users\Imray\projects Practice\meanIO\meanApp\node_modules\meanio\node_modules\lazy-dependab
le\index.js:55:10)
[nodemon] app crashed - waiting for file changes before starting...
According to your output you have Error: listen EADDRINUSE.
It means that you already have running process on this port.
Try to investigate which process uses this port by typing:
sudo lsof -n -i4TCP:$PORT_NUMBER | grep LISTEN
Kill that process and restart your application.
If you need that process, change your application port.
EADDRINUSE is a low level system error, that usually means there's something else running on the port number you're using. Try using a different port.
EDIT: Note that it may not just be the actual server who's port is invalid. It looks like your deployment script creates a debugger, and possibly other services that listen on various ports, so they might need to be changed instead.
The problem went away after I restarted my computer. Not sure why, but I'll take it.

Resources