KeystoneJS yo的创建问题
发布于 6 年前 作者 dphdjy 6706 次浏览 最后一次编辑是 4 年前 来自 问答

直接 yo keystone Welcome to KeystoneJS.

? What is the name of your project? pol
? Would you like to use Jade, Swig, Nunjucks or Handlebars for templates? [jade? Would you like to use Jade, Swig, Nunjucks or Handlebars for templates? [jade? Enter an email address for the first Admin user: dphdjy[@pol](/user/pol)
? Enter a password for the first Admin user: dphdjy
? Would you like to include gulp or grunt? [gulp | grunt] grunt
? Would you like to create a new directory for your project? No
? ------------------------------------------------
KeystoneJS integrates with Mandrill (from Mailchimp) for email sending.
Mandrill accounts are free for up to 12k emails per month.
Would you like to include Email configuration in your project? Yes
? ------------------------------------------------
Please enter your Mandrill API Key (optional).
See for more info.

You can skip this for now (we'll include a test key instead)

Your Mandrill API Key: 
? ------------------------------------------------
? ------------------------------------------------
KeystoneJS integrates with Cloudinary for image upload, resizing and
hosting. See for more info.

CloudinaryImage fields are used by the blog template.

You can skip this for now (we'll include demo account details)

? ------------------------------------------------
Finally, would you like to include extra code comments in
your project? If you're new to Keystone, these may be helpful. Yes

                throw err0;
Error: EACCES, permission denied '/home/dphdjy/workspace/pol/models'
at Object.fs.mkdirSync (fs.js:654:18)
at Function.sync (/usr/local/lib/node_modules/generator-keystone/node_modules/yeoman-generator/node_modules/mkdirp/index.js:70:13)
at KeystoneGenerator.models (/usr/local/lib/node_modules/generator-keystone/app/index.js:327:7)
at /usr/local/lib/node_modules/generator-keystone/node_modules/yeoman-generator/lib/base.js:395:14
at processImmediate [as _immediateCallback] (timers.js:354:15)

使用sudo yo keystone

Error: EACCES, permission denied '/home/user/.config/configstore/insight-yo.yml'
You don't have access to this file.

at Object.fs.openSync (evalmachine.<anonymous>:439:18)
at Object.fs.readFileSync (evalmachine.<anonymous>:290:15)
at Object.create.all.get (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:34:29)
at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/configstore/index.js:27:44)
at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/index.js:26:34)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/cli.js:123:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
3 回复

ERR! Please try running this command again as root/Administrator.

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.