balderdashy / balderdashy/sails

Sails New Demo App Dead on Arrival Due to NeDB Errors

Open
#7,362 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Basics**
Operating System: MacOS 15.5
Node Version: 24.4.0
NPM Version: 11.4.2
Sails Version: 1.5.14

**Issue**
I decided to check out Sails.js for the first time today. Following the [Getting Started](https://sailsjs.com/get-started) page, this was my experience:

```sh
$ npm install sails -g
...
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated glob@7.1.2: Glob versions prior to v9 are no longer supported
...

$ sails new test-project
Choose a template for your new Sails app:
1. Web App · Extensible project with auth, login, & password recovery
...
? 1
...

$ cd test-project
$ sails lift

info: Starting app...

info: Initializing project hook... (`api/hooks/custom/`)
info: Initializing `apianalytics` hook... (requests to monitored routes will be logged!)
info: ·• Auto-migrating... (alter)
info: Hold tight, this could take a moment.
(node:24478) [DEP0044] DeprecationWarning: The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
info: ✓ Auto-migration complete.

debug: Running v0 bootstrap script... (looks like this is the first time the bootstrap has run on this computer)
error: Bootstrap encountered an error: (see below)
error:
error: OperationalError [AdapterError]: Unexpected error from database adapter: util.isDate is not a function
at module.exports.bootstrap (/Users/tom/Code/Playground/test-project/config/bootstrap.js:62:14) {
cause: Error [AdapterError]: Unexpected error from database adapter: util.isDate is not a function
at module.exports.bootstrap (/Users/tom/Code/Playground/test-project/config/bootstrap.js:62:14) {
adapterMethodName: 'createEach',
modelIdentity: 'user',
raw: TypeError: util.isDate is not a function
at Object.deepCopy (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/model.js:116:14)
at Datastore.prepareDocumentForInsertion (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:384:25)
at /Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:382:59
at Array.forEach ()
at Datastore.prepareDocumentForInsertion (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:382:12)
at Datastore._insert (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:348:24)
at /Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/executor.js:40:13
at Immediate.process (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/node_modules/async/lib/async.js:731:21)
at process.processImmediate (node:internal/timers:505:21)
},
isOperational: true,
adapterMethodName: 'createEach',
modelIdentity: 'user',
raw: TypeError: util.isDate is not a function
at Object.deepCopy (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/model.js:116:14)
at Datastore.prepareDocumentForInsertion (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:384:25)
at /Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:382:59
at Array.forEach ()
at Datastore.prepareDocumentForInsertion (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:382:12)
at Datastore._insert (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/datastore.js:348:24)
at /Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/lib/executor.js:40:13
at Immediate.process (/Users/tom/Code/Playground/test-project/node_modules/@sailshq/nedb/node_modules/async/lib/async.js:731:21)
at process.processImmediate (node:internal/timers:505:21)
}

error: Could not load Sails app.
error:
error: Tips:
error: • First, take a look at the error message above.
error: • Make sure you've installed dependencies with `npm install`.
error: • Check that this app was built for a compatible version of Sails.
error: • Have a question or need help? (http://sailsjs.com/support)
```

---

Since this seems to be an NeDB error, I went to check in with NeDB. Looks like they stopped maintenance in 2021 (https://github.com/louischatriot/nedb/commit/2436f616c337fc7f41858f5428f749080a0367cd) and there [has not been any new code added since 2016](https://github.com/louischatriot/nedb/commits/master/).

Perhaps it's time to rely on something else for the demo functionality.

The *Empty* app option (option 2 when running `sails new`) generated an app that ran fine.

Contributor guide

Open the contributing guide

Research direction

Reproduce the Web App template from the Getting Started flow with the reported Node.js and Sails versions, then inspect config/bootstrap.js around line 62 and the NeDB stack at @sailshq/nedb/lib/model.js:116. Determine how the demo template should avoid the util.isDate failure or replace its database dependency; done means the generated Web App starts and its bootstrap completes without the adapter error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, databases
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.