The fastest way to create a Node.js website. For a deep dive, check out the docs.
You'll be using the KeystoneJS generator made with Yeoman. In your root directory run:
npm install -g generator-keystone
Create your project wherever you want:
mkdir my-test-project
Than make sure you're in your new project:
cd my-test-project
yo keystone
The generator will ask you a few questions about what features you'd like to include, then configure and copy all the files you'll need into your project.
It will also install dependencies from npm so you're ready to go.
So you just created your first KeystoneJS project, congrats!
Run it in your command line like this:
node keystone
Then open http://localhost:3000 to view it in your browser.
If you want to see what the generator actually did take a look at our getting started guide, it'll walk you through the manual setup process. This is particularly helpful if you're new to Node.js.
Something went wrong? Hopefully these tips will help.
When running npm install -g generator-keystone, you may get an EACCES error asking you to run the command again as root/Administrator. This indicates that there is a permissions issue.
On your development system you can change directory ownership to the current $USER so you do not have to run sudo while installing untrusted code:
sudo chown -R $USER /usr/local # Other directories may be required depending on your O/S sudo chown -R $USER /usr/lib/node_modules/
For a production/shared environment you may wish to re-run the npm command with the sudo prefix:
sudo npm install -g generator-keystone
For more information, see the "What, no sudo?" of the Intro to npm by Isaac Schulueter.
By default, KeystoneJS will look for a MongoDB server running on localhost on the default port, and connect to it. If you're getting errors related to the MongoDB connection, make sure your MongoDB server is running.
If you haven't installed MongoDB yet, follow the instructions below.
To connect to a server other than localhost, add a MONGO_URI setting to the .env file in your Keystone project directory:
MONGO_URI=mongodb://your-server/database-name
If your issue still isn't resolved, reach out to us on the KeystoneJS Google Group.