How can I upgrade Ghost with npm problem?

January 22, 2017 2.2k views
Ubuntu Ghost

I followed the directions here to upgrade to the newest version of Ghost (0.11.4). When I got to run the command npm install --production, I get an error message that npm has unmet dependencies and that I am holding broken packages.
What can I do?
Thanks.

1 Answer

@geraldardito

Have you tried running

npm cache clean \
&& rm -rf node_modules \
&& npm install --production

That’s what is suggested if you’re met with unexpected results. Warnings are not so much an issue, unless they result in the installation failing and/or your installation of Ghost ceasing to function.

  • Thanks for this.
    When I tried the command && rm -rf node_modules \ I got an error -bash: syntax error near unexpected token `&&'

    Any ideas?

  • Okay. I just realized what I did wrong. I posted your code as individual lines rather than as one piece.
    When I did the right thing, here’s what I got:

    npm ERR! install Couldn't read dependencies
    npm ERR! Linux 3.13.0-86-generic
    npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--production"
    npm ERR! node v4.7.2
    npm ERR! npm  v2.15.11
    npm ERR! path /home/gardito/package.json
    npm ERR! code ENOPACKAGEJSON
    npm ERR! errno -2
    npm ERR! syscall open
    
    npm ERR! package.json ENOENT: no such file or directory, open '/home/gardito/package.json'
    npm ERR! package.json This is most likely not a problem with npm itself.
    npm ERR! package.json npm can't find a package.json file in your current directory.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/gardito/npm-debug.log
    
    

    What’s next?

    • @geraldardito

      The error:

      npm ERR! package.json ENOENT: no such file or directory, open '/home/gardito/package.json'
      npm ERR! package.json This is most likely not a problem with npm itself.
      npm ERR! package.json npm can't find a package.json file in your current directory.
      

      Is hinting at the fact that inside the directory you’re currently in, there’s not a package.json file. The rest of the output is simply confirming that it can’t read your dependencies from this file, thus the install fails.

      We can check if there is a valid packages.json file by running ls in the directory and seeing if one pops up. If one doesn’t you either need to add one or create one using:

      npm init
      

      and then run the install command again.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!