Gatsby Documentation Update
See original GitHub issueSummary
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:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
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
provision.sh
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 thevagrant 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
andnvm 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 usingsudo
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.
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.