Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing v1.1.0 throws two version of Node error #447

Closed
Mohitsharma44 opened this issue Aug 15, 2017 · 20 comments
Closed

Installing v1.1.0 throws two version of Node error #447

Mohitsharma44 opened this issue Aug 15, 2017 · 20 comments
Labels

Comments

@Mohitsharma44
Copy link

Mohitsharma44 commented Aug 15, 2017

This issue is a

  • [ x ] Bug Report

Summary

Tried installing v1.1.0 in a vagrant environment using nvm and node v6.11.2 today and causes the following error:

The version of Ghost-CLI you are running was not installed with this version of Node.\n
This means there are likely two versions of Node running on your system, please ensure\n
that you are only running one global version of Node before continuing

Steps to Reproduce

  1. Install nvm and source it (based on readme instructions here: https://github.com/creationix/nvm)
  2. nvm install v6.11.2
  3. symlink the node executable to /usr/local/bin
  4. npm install -g sqlite3
  5. npm install -g ghost-cli
  6. cd into the directory where I want to install ghost and run ghost install local --url=http://127.0.0.1 --ip=0.0.0.0 --port-2368 --db=sqlite3 --no-prompt

Note that above command is executed without root privileges.
the above line will throw the error.

The above installation steps worked fine exactly 2 days ago when I created a playbook.

To me, it looks like it was caused due to this specific commit: ea30015

Technical details:

  • OS: Trusty64
  • Node Version: 6.11.2 (also same issue with 6.11.0 and 6.11.1)
  • Ghost-CLI Version: v1.1.0
  • Environment: Vagrant (setup using Ansible)

If you need the playbook (it is one, big, ugly, yaml file since it's a part of tutorial): https://github.com/Mohitsharma44/ansible-playbooks/blob/master/test/vagrant3/playbook.yml

@Mohitsharma44 Mohitsharma44 changed the title Installing v1.1.0 causes permission issues Installing v1.1.0 throws two version of Node error Aug 15, 2017
@Mohitsharma44
Copy link
Author

Mohitsharma44 commented Aug 15, 2017

This is the error output when I run the play:

fatal: [192.168.60.11]: FAILED! => {
"changed": true, 
"cmd": "ghost install local --url=http://127.0.0.1 --ip=0.0.0.0 --port=2368 --db=sqlite3 --no-prompt", 
"delta": "0:00:01.646015", 
"end": "2017-08-15 19:37:31.734476", 
"failed": true, 
"rc": 1, 
"start": "2017-08-15 19:37:30.088461", 
"stderr": "Message: The version of Ghost-CLI you are running was not installed with this version of Node.\nThis means there are likely two versions of Node running on your system, please ensure\nthat you are only running one global version of Node before continuing.", 
"stderr_lines": ["Message: The version of Ghost-CLI you are running was not installed with this version of Node.", "This means there are likely two versions of Node running on your system, please ensure", "that you are only running one global version of Node before continuing."], 
"stdout": "\u001b[?25l[19:37:31] Checking system Node.js version [started]\n[19:37:31] Checking system Node.js version [failed]\n[19:37:31] → The version of Ghost-CLI you are running was not installed with this version of Node.\nThis means there are likely two versions of Node running on your system, please ensure\nthat you are only running one global version of Node before continuing.\n\u001b[?25hA SystemError occurred.\n\nDebug Information:\n    Node Version: v6.11.0\n    Ghost-CLI Version: 1.1.0\n    Environment: development\n    Command: 'ghost install local --url=http://127.0.0.1 --ip=0.0.0.0 --port=2368 --db=sqlite3 --no-prompt'\n\nPlease refer to https://docs.ghost.org/docs/troubleshooting#section-cli-errors for troubleshooting.\n\u001b[?25h", 
"stdout_lines": 
[
"[19:37:31] Checking system Node.js version [started]", 
"[19:37:31] Checking system Node.js version [failed]", 
"[19:37:31] → The version of Ghost-CLI you are running was not installed with this version of Node.", 
"This means there are likely two versions of Node running on your system, please ensure", 
"that you are only running one global version of Node before continuing.", 
"A SystemError occurred.", "", 
"Debug Information:", 
"    Node Version: v6.11.0", 
"    Ghost-CLI Version: 1.1.0", 
"    Environment: development", 
"    Command: 'ghost install local --url=http://127.0.0.1 --ip=0.0.0.0 --port=2368 --db=sqlite3 --no-prompt'", 
"", 
"Please refer to https://docs.ghost.org/docs/troubleshooting#section-cli-errors for troubleshooting.", 
]
}

@acburdine
Copy link
Member

@Mohitsharma44 so the reason this is failing is because you are symlinking the ghost executable into the system bin dir - so in essence while you don't have two versions of node installed on your system, the CLI thinks you do because npm bin -g returns ~/.nvm/versions/<version>/bin, and running ghost shows up as /usr/local/bin/ghost.

Also - why are you running ghost install local for install? If you're intending to run this in production running ghost install local is not the correct, or recommended way to do it 😉

@acburdine
Copy link
Member

acburdine commented Aug 15, 2017

The two ways I think you could solve this issue are:

  1. don't link the ghost executable into the system bin dir OR
  2. install nvm globally (you can follow this tutorial)

@Mohitsharma44
Copy link
Author

@acburdine Ahhaa... The reason you mentioned makes sense. I'll probably try installing nvm globally (but that would mean installing any npm package globally requires root privileges). Is there any reason why you chose to not use local npm version?

About why I'm using locally, it's just for testing...

@acburdine
Copy link
Member

@Mohitsharma44 the reason for that is ghost creates a specific ghost user with which to run ghost. If you install nvm locally (e.g. in ~/.nvm), there is a very real (e.g. has happened several times) possibility that the created ghost user won't be able to run ghost because the home folder doesn't allow read permissions for everyone on the filesystem.

Going to close this issue for now - if more people have issues with this then we can reopen and figure out a better solution 😁

@SparkyDoosan
Copy link

SparkyDoosan commented Aug 16, 2017

FWIW my environment is installed correctly but the NPM path includes a network path my host uses to affect backups.

$ which ghost
/home3/r/me/.nvm/versions/node/v6.11.1/bin/ghost
$ npm root -g
/nfs/home3/home3/r/me/.nvm/versions/node/v6.11.1/lib/node_modules

Given these are the exact same version, I felt good employing a workaround:

export PATH=/nfs/home3/home3/r/me/.nvm/versions/node/v6.11.1/bin:$PATH

I could guess this corner case (all is well even while it looks bad) isn't interesting enough to address (some sort of real path check like NVM did when I installed it?) but wanted to share.

@sudomateo
Copy link

I am running CentOS 7 and also experienced this issue on a fresh installation.

All I have done so far:

# Install pre-reqs
...
yum install -y epel-release
yum install -y nodejs --enablerepo=cr #needed to install the http-parser package since CentOS 7.4 is coming out and that package was pulled from epel repo to base repo
npm i -g ghost-cli
mkdir -p /srv/mysite/www/ghost
cd /srv/mysite/www/ghost
ghost install -V

The output I receive from the last command

[root@server01 ghost]# ghost install -V
[22:02:51] Checking system Node.js version [started]
[22:02:53] Checking system Node.js version [failed]
[22:02:53] → The version of Ghost-CLI you are running was not installed with this version of Node.
This means there are likely two versions of Node running on your system, please ensure
that you are only running one global version of Node before continuing.
A SystemError occurred.

Message: The version of Ghost-CLI you are running was not installed with this version of Node.
This means there are likely two versions of Node running on your system, please ensure
that you are only running one global version of Node before continuing.

Debug Information:
    Node Version: v6.11.1
    Ghost-CLI Version: 1.1.1
    Environment: production
    Command: 'ghost install -V'

Please refer to https://docs.ghost.org/v1/docs/troubleshooting#section-cli-errors for troubleshooting.

@sudomateo
Copy link

sudomateo commented Aug 30, 2017

I rolled back ghost-cli one version at a time and then kept trying to run ghost install. It was successful once I installed ghost-cli v1.0.3.

[root@web01-nyc1 ghost]# ghost --version
Ghost-CLI version: 1.0.3
[root@web01-nyc1 ghost]# ghost install -V
[22:25:00] Checking system Node.js version [started]
[22:25:00] Checking system Node.js version [completed]
[22:25:00] Checking current folder permissions [started]
[22:25:00] Checking current folder permissions [completed]
[22:25:00] Checking operating system [started]
System checks failed with message: 'Linux version is not Ubuntu 16'
Some features of Ghost-CLI may not work without additional configuration.
For local installs we recommend using `ghost install local` instead.
? Continue anyway? (y/N)

@acburdine
Copy link
Member

@msanabria would you be able to run a couple of commands and post the output? (none of them should reveal anything private)

  • npm bin -g
  • npm root -g
  • which ghost

@sudomateo
Copy link

@acburdine here you go.

[root@web01-nyc1 ~]# npm bin -g
/usr/bin
[root@web01-nyc1 ~]# npm root -g
/usr/lib/node_modules
[root@web01-nyc1 ~]# which ghost
/bin/ghost
[root@web01-nyc1 ~]# ll /bin/ghost
lrwxrwxrwx. 1 root root 39 Aug 30 22:20 /bin/ghost -> ../lib/node_modules/ghost-cli/bin/ghost
[root@web01-nyc1 ~]#

@acburdine
Copy link
Member

Hmm....ok - does /bin happen to be a symlink of /usr/bin?

@sudomateo
Copy link

@acburdine Yessir. CentOS moved bin, sbin, lib, and lib64 into /usr and created symlinks for backwards compatibility. Here's the output:

[root@web01-nyc1 ~]# ll /
total 60
lrwxrwxrwx.  1 root root     7 Jun 19 22:56 bin -> usr/bin
...
lrwxrwxrwx.  1 root root     7 Jun 19 22:56 lib -> usr/lib
lrwxrwxrwx.  1 root root     9 Jun 19 22:56 lib64 -> usr/lib64
...
lrwxrwxrwx.  1 root root     8 Jun 19 22:56 sbin -> usr/sbin
...

@acburdine
Copy link
Member

Ah ok that makes sense - I'll open a separate issue to fix that.

@xratzh
Copy link

xratzh commented Sep 7, 2017

@acburdine I tried Ubuntu and anything works well.The problem seems only happened on CentOS

@sudomateo
Copy link

Oh and before people start to say that SELinux may be the issue, I've tried with both SELinux in permissive or in enforcing mode. Just seems to be failing a pre installation check.

@acburdine
Copy link
Member

It's not that - I know what the issue is and will fix it in the next version :)

@sudomateo
Copy link

@acburdine Thank you for working to fix this! I just said my comment about SELinux because a lot of discussions end up pointing fingers at SELinux rather than focusing on the issue itself. Looking forward to the fixed release!

@Bilge
Copy link

Bilge commented Sep 18, 2017

Have exactly the same issue on Arch Linux.

# npm bin -g
/usr/bin
# npm root -g
/usr/lib/node_modules
# which ghost
/usr/sbin/ghost
# ls -la /usr/sbin
lrwxrwxrwx 1 root root 3 Mar 26 21:57 /usr/sbin -> bin
# ls -la /bin
lrwxrwxrwx 1 root root 7 Mar 26 21:57 /bin -> usr/bin

If I roll back to 1.0.3 as suggested I just get a different error.

Message: The version of Node.js you are using is not supported.
Supported: ^4.5.0 || ^6.5.0
Installed: 8.5.0

It's just hopeless trying to install post-1.0 versions of Ghost.

@DanielNeutrinos
Copy link

Same problem trying to install on raspbian
$ npm bin -g
/home/pi/.npm-global/bin

$ npm root -g
/home/pi/.npm-global/lib/node_modules

$ which ghost
/usr/bin/ghost

$ ls -l /usr/bin/ghost
lrwxrwxrwx 1 root root 39 Oct 16 04:45 /usr/bin/ghost -> ../lib/node_modules/ghost-cli/bin/ghost

And had the same error as @Bilge when rolling back to v1.0.3

@amio
Copy link

amio commented Nov 1, 2017

@acburdine I don't have nvm on ubuntu 16 but still get this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants