Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChristopher Stuart
Full Stack JavaScript Techdegree Graduate 27,771 PointsProblems on NPM START
So when I go to run NPM Start I get an error like this:
cannot find module .....configconfig.json
So I looked in the index file and it appeared that the slashes were in the wrong direction when config var is defined? like so () instead of (/)....not sure if this was wrong but it looked wrong to me and I changed it.
Now when I run NPM start my cmd line just gets stuck with this and doesn't create anything
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules\sequelize\lib\sequelize.js:236:13
Executing (default): CREATE TABLE IF NOT EXISTS Articles
(id
INTEGER PRIMARY KEY AUTOINCREMENT, title
VARCHAR(255), author
VARCHAR(255), body
TEXT, createdAt
DATETIME NOT NULL, updatedAt
DATETIME NOT NULL);
Executing (default): PRAGMA INDEX_LIST(Articles
)
Any idea what might be going on?
2 Answers
Lee Vaughn
Treehouse TeacherI ran into a similar problem and I didn't find anything in the article the error message references that helped to sort out the issue (Changing the STRING to TEXT as the other poster mentioned also didn't allow the npm start command to complete successfully).
However, if you check out the documentation on Migration, which covers installing the CLI, and scroll down to the "Running Migrations" section there is another way to set up the database file. That is by running the db:migrate command (node_modules/.bin/sequelize db:migrate).
Again, not sure why npm start is hanging up rather than successfully creating the file but using the db:migrate command instead will at least allow you to create the necessary development.db file in the root directory and continue with the lessons.
Andreas Beyer
Full Stack JavaScript Techdegree Student 12,474 PointsI got this Error too:
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13 /Users/mrmackie/Documents/Treehouse/notes/12_SQL/node_modules/sequelize/lib/model.js:804 throw new Error('Unrecognized data type for field ' + name); ^
Error: Unrecognized data type for field title
models/article.js: There is some problem with the .STR in author and body
'use strict'; module.exports = (sequelize, DataTypes) => { var Article = sequelize.define('Article', { title: DataTypes.STR, author: DataTypes.STR, body: DataTypes.TEXT }, {}); Article.associate = function(models) { // associations can be defined here }; return Article; };
So i edited models/article.js: ... author: DataTypes.TEXT, body: DataTypes.TEXT ...
Now, there is still a warning but no Error:
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13
Executing (default): CREATE TABLE IF NOT EXISTS Articles
(id
INTEGER PRIMARY KEY AUTOINCREMENT, title
TEXT, author
TEXT, body
TEXT, createdAt
DATETIME NOT NULL, updatedAt
DATETIME NOT NULL);
Executing (default): PRAGMA INDEX_LIST(Articles
)
When editing config.JSON the warning disappears:
config/config.json:
{ "development": { "storage": "development.db", "dialect": "sqlite", "operatorsAliases": false },
"test": { "storage": "test.db", "dialect": "sqlite", "operatorsAliases": false },
"production": { "storage": "production.db", "dialect": "sqlite", "operatorsAliases": false } }
Andreas Beyer
Full Stack JavaScript Techdegree Student 12,474 PointsAndreas Beyer
Full Stack JavaScript Techdegree Student 12,474 PointsI am having the same problem.