Kishore032's avatar

Mix stops npm install

Please help!!

Mix installs fine on my home computer. When I try to install on my server, I keep getting the same error again and again - on two different (shared) hosts hostgator & bluehost.

nvm and node seem to install fine. npm -v 6.1.0 node -v v10.5.0 php artisan -V Laravel Framework 5.6.26

When I do an 'npm run dev', I get an error that seems to be thrown by Mix.

cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

node[2822]: pthread_create: Resource temporarily unavailable events.js:167 throw er; // Unhandled 'error' event ^

Error: spawn node_modules/webpack/bin/webpack.js EAGAIN at Process.ChildProcess._handle.onexit (internal/child_process.js:229:19) at onErrorNT (internal/child_process.js:406:16) at process._tickCallback (internal/process/next_tick.js:63:19) at Function.Module.runMain (internal/modules/cjs/loader.js:746:11) at startup (internal/bootstrap/node.js:240:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:564:3) Emitted 'error' event at: at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12) at onErrorNT (internal/child_process.js:406:16) [... lines matching original stack trace ...] at bootstrapNodeJSCore (internal/bootstrap/node.js:564:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @ development script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

[Indeed I've cleared npm caches and tried multiple fresh installs. This is from a complete fresh install of laravel and node].

From what I have researched so far (which may or may not be relevant):

-- [email protected]-- [email protected] -- [email protected]-- [email protected] -- [email protected]-- [email protected] -- [email protected]-- [email protected]

I'll appreciate any and all help.

Thanks

0 likes
3 replies
NickVahalik's avatar
Level 8

It very well could be that your hosting server limits the number of processes that you can initialize. This is sometimes just a limitation of shared hosts but can also be a security measure to prevent scripts from spawning multiple copies or from taking up more resources than you can utilize.

I'd contact your hosting provider to verify this limitation and see if there is anything that they can do about it. Chances are, this might simply be a limitation that you'll need to solve elsewhere in your deployment strategy. (i.e. you might need to do this locally and then transmit the compiled components over to your host.)

To check this, log in and run ulimit -a on your shared hosting server. You should see some output which also shows the maximum number of allowed processes:

...
cpu time               (seconds, -t) unlimited
max user processes              (-u) 50    <-- Right here.
virtual memory          (kbytes, -v) unlimited
...
Kishore032's avatar

Thank you. The problem was indeed with the number of processes. So, I have taken the approach of compiling locally and uploading the CSS and js which seems to work. Thanks again!

Please or to participate in this conversation.