I'm using Webpack along with Babel to compile my jsx into js. --watch will work a few times but then stop afterwards. I've had to resort to manually typing in webpack every time in order to make sure my scripts get compiled.
I had a similar problem to this where it turned out that webpack was silently failing to report that I had exceeded the max number of inotify watchers in Linux. Webpack watch uses inotify to observe file changes.
You can immediately try a fix to see if it works with:
sudo -i
echo 1048576 > /proc/sys/fs/inotify/max_user_watches
exit
The long term fix would be to increase your allowed watchers by editing your /etc/sysctl.conf to include this line: fs.inotify.max_user_watches=1048576.
The issue was reported here: https://github.com/webpack/webpack/issues/1281
Related
I running code nativescript code with command tns run android --bundle and its also run with memory 4096MB. My RAM is 16. Why can it run on 4 not over more?
"Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
Running webpack for Android...
clean-webpack-plugin: P:...\platforms\android\app\src\main\assets\app*** has been removed.
File change detected. Starting incremental webpack compilation...
Starting type checking service...
Using 1 worker with 4096MB memory limit"
This log is produced by the ForkTsCheckerWebpackPlugin.
Just open your <projectRoot>/webpack.config.js file and increase the memoryLimit property in the ForkTsCheckerWebpackPlugin initialization.
I wanted to increase the heap size of my node project. So I installed increase-memory-limit package.
But when I execute increase-memory-limit in the terminal I get an error of "increase-memory-limit: command not found". Please help me if I am missing something.
thanks in advance.
Not sure why you need a module for that.
Just pass a value to the --max_old_space_size V8 flag when you're starting up your server. For example, if you're using index.js as the entry point and you want 2048 MB of managed heap you would do:
$ node --max_old_space_size=2048 index.js
Do note that V8 flags should be declared before the file you want to run.
I have a nodejs project written in Typescript. Therefore, i have webpack using a typescript loader that transpiles my code in Javascript and bundles it in a server.js file (in a dist folder)
When in developement conditions, my webpack runs with its watcher ON and so does nodemon.
Problem is, when i launch my script for the first time combining webpack and nodemon, since webpack is in watch mode it doesn't have an exit code saying that everything is ok, nodemon script can be started. If i run them simultaneously, nodemon will launch faster than webpack and since server.js file doesn't yet exist, it will crash at the start.
I want to launch thanks to one single command both scripts but make nodemon command wait for the bundling to be done.
First of all, when please provide some code when submitting questions.
and since server.js file doesn't yet exist
I think you should work around your setup a little bit s.t. webpack doesn't create your server.js file if you want to do this.
Basically you can chain multiple commands in a script like so webpack -d && nodemon index.js. This will launch node after webpack completes. However if you setup webpack in watch mode -w it never exists, so you can't chain another command to it. So webpack -d -w && nodemon index.js never gets to the nodemon part.
A solution to the above is to chain them using only &, which I guess you are doing, but in this way they both start at the same time. Hence, if you make your setup independent (webpack doesn't interfere with nodemon starting script) you can list them like so.
If for whatever reasons you can't do this or don't want to, your only option is with 2 separate scripts that you launch manually one after the other.
If I were you, I would just use nodemon-webpack-plugin:
Uses Nodemon to watch and restart your module's output file, but only
when webpack is in watch mode (ie, --watch).
Saves the need for installing, configuring and running Nodemon as a
seperate process.
So when running the following command I'm expecting node-sass to compile and start watching. If I have to run a separate node-sass -w command wouldn't I have to include all the same parameters I included on the first? Seems like an odd way of doing things.
node-sass app/styles -o app/styles --source-map true --include-path app/bower_components --quiet --watch
Actually watch triggers compilation each and every time the file changes, as the (sass) documentation states:
You can also tell Sass to watch the file and update the CSS every time the Sass file changes: [...]
However, the documentation says nothing about what happens when the watch process starts, which is what led you to expect it to compile right after being invoked.
It's, for sure, an odd way of doing things.
I'm new to *Hapi *framework. During development, I have to restart the hapi server whenever I made any changes to the code.
For the view part, I can add an option {isCached: false}to make the view read the latest html file every time. However, is there an easy setting to make it reload code automatically whenever it is changed?
UPDATE:
Thanks to dylants' suggestion, Nodemon works great.
However, in my app there is a selenium-standalone child process, whenever the nodemon restarts, it will generate an error log. ...Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again...
I have tried https://github.com/remy/nodemon#controlling-shutdown-of-your-script, it doesn't help.
I've used nodemon. You just start your server with $ nodemon instead of $ npm start and every time you make a change to your server code it restarts the server.
I have found node-dev to work well for me.
npm install -g node-dev
I personally prefer pm2 to achieve this.
pm2 start app --watch
More info about pm2: http://pm2.keymetrics.io/