question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gatsby Documentation Update

See original GitHub issue

Summary

gatsbyjs documentation > 0. Set Up Your Development Environment > Create a Gatsby site

The shell command is incorrect to create a new gatsby site gatsby new hello-world https://github.com/gatsbyjs/gatsby/tree/master/starters/hello-world

The command returns:

ERROR starter https://github.com/gatsbyjs/gatsby/tree/master/starters/hello-world doesn’t exist

Proposed Solution

From the documentation at the above address, the shell command should be gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world

This does create the new ‘hello-world’ site. However, likely a separate issue, upon successful creation of the starter directory layout, this error occurs

info Creating new site from git: https://github.com/gatsbyjs/gatsby-starter-hello-world.git
Cloning into 'my-hello-world-starter'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 16 (delta 0), reused 9 (delta 0), pack-reused 0
Unpacking objects: 100% (16/16), done.
Checking connectivity... done.
success Created starter directory layout
info Installing packages...
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /vagrant/my-hello-world-starter/node_modules/yurnalist/node_modules/debug/package.json.1939036142
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/vagrant/my-hello-world-starter/node_modules/yurnalist/node_modules/debug/package.json.1939036142'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2020-08-17T02_28_25_198Z-debug.log

ERROR 

Command failed with exit code 254: npm install
Error: Command failed with exit code 254: npm install

  - error.js:56 makeError
    [lib]/[gatsby-cli]/[execa]/lib/error.js:56:11

  - index.js:114 handlePromise
    [lib]/[gatsby-cli]/[execa]/index.js:114:26

  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7

This is fixed by changing directory to hello-world and running npm install as per the template repositories README.md.

Motivation

The documentation should be updated as instructions up to this point are solid. It may also be beneficial to reference the bash script lines:

=> nvm source string already in /home/vagrant/.bashrc
=> bash_completion source string already in /home/vagrant/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Nowhere in the documentation does it mention restarting your terminal or the option to manually run the 3 lines referenced above.

Steps to resolve this issue

Update the url of the hello-world starter repository Mention that you must restart your terminal in order for the changes to take affect.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
RyanRLongcommented, Aug 18, 2020

this is rlong.io from my personal account

@polarathene I will take you up on the offer for help soon and appreciate you taking the time to clarify.

This was an attempted vagrant installation:

Vagrantfile

Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/bionic64"
    config.vm.network "forwarded_port", guest: 8000, host: 8000
    config.vm.network "public_network", ip: "192.168.1.34"
    config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ["dmode=777", "fmode=776"]
    config.vm.provision "shell", path: "provision.sh"
end

provision.sh

sudo apt-get update && sudo apt-get upgrade -y
git config --global user.name "Ryan Long"
git config --global user.email "ryan@rlong.io"

I was trying to build the image first manually and writing the steps that succeeded into the provision.sh script, the above was the only part implemented during the vagrant up.

I followed the Gatsby instructions from the gatsbyjs.com site /tutorial/part-zero -0. Set Up Your Development Environment Ubuntu, Debian, and other apt based distros

I stumbled for a while (my fault for not reading more carefully) after runnning curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash when I finally read the message and realized I had to either restart or run the commands displayed.

After running nvm install 10 and nvm use 10, I verified the versions and everything looked correct.

It was once I tried to start the “hello world starter” that things started to fall apart.

The shell command from the documentation failed, so I entered the URL in my browser and followed the installation instructions there. The npm install from the starter project was the part I could not get to work. There would always be a dependency failure, either gatsby itself was missing, or a sub_module ~yasuoti was missing (though this was not in the package.json)

I’m fairly certain that the root cause is installing gatsby-cli in vagrant. I did at first without using sudo as per the docs, then with sudo, then just tried poking and hoping, not installing it globally, etc.

I was able to install without issue in a Windows 10 environment, which again leads me to believe it is a vagrant vs. node issue.

This is why I closed the ticket; it seemed more like a vagrant/environment issues than a gatsby/node issue.

0reactions
polarathenecommented, Aug 18, 2020

then with sudo

Don’t do that for globally installed packages. NVM and others like it are meant to provide a version of node/npm that is local to the user, sudo would be required for installing to root owned files(eg the system/OS and it’s admin user that should be separate from your own logged in user). That will cause problems for this sort of development.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade for Minor or Patch Releases - Gatsby
To keep up with the latest bug fixes, security patches, and minor releases from both Gatsby and its dependencies, you should upgrade often...
Read more >
Gatsby Changelog | 5.3.0
We've updated GraphiQL from v1 to v2 to bring you these cool new features: Dark Mode; Tabs; Persisted State/Tabs using localStorage; Better documentation...
Read more >
[docs] how to upgrade Gatsby and dependencies for minor ...
We should add a doc on how to upgrade Gatsby after you've created a site. For many developers, the steps to do that...
Read more >
Gatsby and Prismic - Documentation
Welcome to the developer documentation for Prismic and Gatsby. ... This guide will show you how to add Prismic to a Gatsby project...
Read more >
Creating a minimalist docs site with Gatsby and MDX
You can also update the header data and links by changing src/gatsby-theme-documentation/header.mdx . # ![Docs Logo](https://contrast.now.sh/white/black?width= ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found