Struggling to install Ghost Migration tools - ERR_SOCKET_TIMEOUT

I’m pretty inexperienced with the command line but have managed to get the latest version of Ghost up and running on a 1GB Digital Ocean droplet using the 1-click app. I wanted to install the ghost migration tool and first tried when logged in as ghost-mgr but got the following errors:

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/lib/node_modules/@tryghost
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@tryghost'

Then I tried installing it after cd’ing into /var/www/ghost but got the same permissions issue. Finally I ran the install command as the root user on my server and that seemed to go—albeit very slowly—and returned the following errors:

npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated hubspot-api@2.15.3: No longer maintained, please use @hubspot/api-client instead
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated superagent@4.1.0: Please upgrade to v7.0.2+ of superagent.  We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing.  See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network request to https://registry.npmjs.org/@tryghost/migrate/-/migrate-0.22.7.tgz failed, reason: Socket timeout
npm ERR! network This is a problem related to network connectivity.

If this is a connectivity issue, should I just try running the installation again? Since I don’t really know what I’m doing I don’t want to make a mess of things with half-installed command line tools, and I’m feeling thrown off by the amount of warnings I was also getting. I have a few posts to migrate over from substack and would rather not have to do it manually, so it’d be great if I could get the migration tool working!

Here’s what I get running ghost doctor:

1) SystemError

Message: You are recommended to have at least 150 MB of memory available for smooth operation. It looks like you have ~82.9140625 MB available.

Debug Information:
    OS: Ubuntu, v20.04.4 LTS
    Node Version: v16.15.0
    Ghost Version: 5.9.3
    Ghost-CLI Version: 1.22.0
    Environment: production
    Command: 'ghost doctor'

Any help is much appreciated, thanks!

The migration tool is something you can run on your own machine — not the server.

You run the tool, do your migration, and then upload the files outputted from the migration to your Ghost site.

Ah that makes a lot more sense, thank you. Should I worry about cleaning up the failed install on my server? If so, how would I go about that?

If you can start Ghost and it’s working, then it should be fine. You can also restart the server (and Ghost) to ensure no extra processes are running.

If it’s a brand new server, then you could just delete the droplet and start fresh.

Just restarted both and everything looks fine, thanks! I installed the migration tool locally but am now getting the following error:

node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module '@tryghost/mg-mediascraper'
Require stack:

And then a long list of directories. Do you know what I might be missing?

I got this error, too. I’ll look into it. :frowning_face:

In the meantime, you can run the tool in development mode, which is working.

  1. run: git clone https://github.com/TryGhost/migrate.git and cd into the migrate directory
  2. Run npm install
  3. Run npm run dev substack path/to/file to run the migration (and add whatever options you need). https://github.com/TryGhost/migrate/tree/main/packages/mg-substack-csv

Thanks for all the patience and help @RyanF!

I managed to run migrate in dev mode and put my substack files through to create the ghost-import.json file. When I imported it to my website, it created all the posts with the right time-stamps and excerpt, but they’re completely blank! And for some reason they are all tagged as “Thread”.

Inside the migration content folder, both the images and media folders are empty, though the html files in my original substack export have all the correct content and text. I’m not seeing any issues in the migration command though so I don’t know what could’ve gone wrong!