Static GitHub Issues

[2649] Unable to build on remote when using nvm

prev: data-src doesn't load images from assets folder
next: Head is not pre-rendered with command nuxt generate

I have updated to the latest releases of Nuxt.js, npm, and Node.js on a shared server using nvm, and when I attempt to run nuxt build, I get this:

jonatha8 [~/public_html]# npm run build

> website-nuxt@1.0.0 build /home/jonatha8/public_html
> nuxt build

  nuxt:pwa Adding manifest +0ms
  nuxt:pwa Adding meta +5ms
  nuxt:pwa Adding workbox +1ms
  ████████████████████ 91% additional chunk assets processingnode[861586]: pthread_create: Resource temporarily unavailable
internal/child_process.js:340
    throw errnoException(err, 'spawn');
    ^

Error: spawn ENOMEM
    at _errnoException (util.js:1003:13)
    at ChildProcess.spawn (internal/child_process.js:340:11)
    at exports.spawn (child_process.js:499:9)
    at Object.exports.fork (child_process.js:100:10)
    at fork (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/worker-farm/lib/fork.js:12:35)
    at Farm.startChild (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/worker-farm/lib/farm.js:106:16)
    at Farm.processQueue (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/worker-farm/lib/farm.js:279:10)
    at Farm.addCall (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/worker-farm/lib/farm.js:307:8)
    at Farm.<anonymous> (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/worker-farm/lib/farm.js:38:10)
    at _class.boundWorkers (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:71:24)
    at enqueue (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:96:17)
    at /home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:116:11
    at Array.forEach (<anonymous>)
    at _class.runTasks (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js:94:13)
    at Compilation.<anonymous> (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/uglifyjs-webpack-plugin/dist/index.js:183:18)
    at next (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/tapable/lib/Tapable.js:204:14)
    at Compilation.compilation.plugin (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/webpack/lib/ProgressPlugin.js:119:6)
    at Compilation.applyPluginsAsyncSeries (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/tapable/lib/Tapable.js:206:13)
    at self.applyPluginsAsync.err (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/webpack/lib/Compilation.js:666:10)
    at next (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/tapable/lib/Tapable.js:202:11)
    at Compilation.compilation.plugin.callback (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/webpack/lib/ProgressPlugin.js:115:6)
    at Compilation.applyPluginsAsyncSeries (/home/jonatha8/.nvm/versions/node/v9.4.0/lib/node_modules/nuxt/node_modules/tapable/lib/Tapable.js:206:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! website-nuxt@1.0.0 build: `nuxt build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the website-nuxt@1.0.0 build 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:
npm ERR!     /home/jonatha8/.npm/_logs/2018-01-20T04_49_16_069Z-debug.log

I'm not sure what to do about this. It seems like there's an issue with trying to use nvm, but I'm unable to update npm + Node.js globally since it's a shared environment, so nvm was my attempt to work around that. When I run -v, everything looks okay:

jonatha8 [~/public_html]# npm -v
5.6.0
jonatha8 [~/public_html]# node -v
v9.4.0

When I run nuxt or nuxt build locally, with npm 5.6.0 and Node.js 9.4.0, it runs and builds correctly.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2304">#c2304</a>)</em></sub></div>