Ghost Upgrade NPM Cannot Run in WD Error

Posted February 5, 2017 3.7k views
UbuntuNode.jsSystem ToolsGhostVPN

I am trying to upgrade to Ghost 0.7.9 and followed the directions of upgrading to a node version 4.2.x < 5.x.x (My version is 4.7.3) and had no issues following all of the steps until I reached having to runnpm install --production for some reason I’m getting
npm WARN cannot run in wd ghost@0.7.9 npm install semver && node -e "require('./core/server/utils/startup-check.js').nodeVersion()" (wd=/var/www/ghost) and can’t seem to figure out a solution. I’m running my droplet via SSH with a root user. Could it be my root user permissions for NPM?

Full run:

npm WARN cannot run in wd ghost@0.7.9 npm install semver && node -e "require('./core/server/utils/startup-check.js').nodeVersion()" (wd=/var/www/ghost)

> jsonpath@0.2.2 postinstall /var/www/ghost/node_modules/jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js


I also tried running npm cache clean and rm -rf node_moudles, but still received the same result. Any help or guidance?

Not sure if this detail helps, but I followed the chown -R ghost:ghost core command presented in step 6 of the ghost upgrade documentation and curious if that impacted the root user that I’m logged in as. Would it?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


At the end of the message, does it by chance echo out killed? I ask as this is common on VPS’s with lower resources. Since npm tends to use quite a bit of resources when initially installing all modules expected by an application (i.e. RAM/Memory), if you run out, it’ll simply kill off the process and fail.

So if you’re running this on a 512MB Droplet, and you see killed, that’s one potential reason. If this is a 1GB Droplet, last I tested, Ghost will install without any issues, though if you’re still seeing killed, then you may have to upgrade to a 2GB.

If you’re not seeing killed echo'ed out, if you run it adding --unsafe-perm to the end, does it work?

  • @jtittle this does not echo out killed. It also appears that the node_modules are installed correctly despite this error as I didn’t have any issues running the applications with exception of having to individually install sqlite3, Not sure if that helps, but this doesn’t seem to be a major issue preventing running the applicaiton

  • I am seeing “killed” when trying to do npm install --production. And I am running on a 512MB droplet. Are there any options other than upgrading?

    • @ryanjm

      If you’re seeing killed, you’ll most likely need to upgrade your Droplet to 1GB at minimum.

      Applications that need to pull down dozens or even hundreds of packages can consume quite a bit of RAM during the installation or update process. Unfortunately, I’ve not found a way to reduce that or put packages in a queue of sorts to ensure that RAM isn’t exhausted.