【发布时间】:2018-07-07 01:55:57
【问题描述】:
我的风帆种子已配置为在模型下放置名称属性的字符串,但它反而使我的应用程序崩溃。
error: Bootstrap encountered an error: (see below)
error:
error: { UsageError: Invalid initial data for new records.
Details:
Could not use one of the provided new records: Missing value for required attribute `name`. Expected a string, but instead, got: undefined
[?] See https://sailsjs.com/support for help.
at Object.module.exports.bootstrap (/Users/adarian/learn-sails/config/bootstrap.js:63:14)
cause:
{ UsageError: Invalid initial data for new records.
Details:
Could not use one of the provided new records: Missing value for required attribute `name`. Expected a string, but instead, got: undefined
[?] See https://sailsjs.com/support for help.
at Object.module.exports.bootstrap (/Users/adarian/learn-sails/config/bootstrap.js:63:14)
name: 'UsageError',
code: 'E_INVALID_NEW_RECORDS',
details:
'Could not use one of the provided new records: Missing value for required attribute `name`. Expected a string, but instead, got: undefined' },
isOperational: true,
code: 'E_INVALID_NEW_RECORDS',
details:
'Could not use one of the provided new records: Missing value for required attribute `name`. Expected a string, but instead, got: undefined' }
由于我的种子文件看起来像这样,我该如何解决这个问题。
/**
* Sails Seed Settings
* (sails.config.seeds)
*
* Configuration for the data seeding in Sails.
*
* For more information on configuration, check out:
* http://github.com/frostme/sails-seed
*/
module.exports.seeds = {
user: [
{
name: "John Wayne",
email: 'johnnie86@gmail.com',
avatar: 'https://randomuser.me/api/portraits/men/83.jpg',
location: 'Mombasa',
bio: 'Spends most of my time at the beach'
}
]
};
【问题讨论】:
标签: sails.js