пн goose дата. js ошибка с номерами индейцев / араби c - PullRequest
0 голосов
/ 25 апреля 2020

У меня проблема со стековым приложением MEAN.

Я использую индийские цифры в приложении, и раньше оно работало просто отлично.

теперь, когда я пытаюсь запустить приложение с

gulp serve или yarn start

Я получаю эту ошибку

/home/app/supplieson_backend/node_modules/mongoose/lib/schema/date.js:246
  throw new CastError('date', value, this.path);
  ^
CastError: Cast to date failed for value "٢٠٢٠-٠٤-٢٤T٢١:٠٦:٠١.٣٠٣Z" at path "createdAt"
    at MongooseError.CastError

Полный вывод

 vagrant@ubuntu-xenial:/home/app/supplieson_backend$ sudo yarn start
    yarn run v1.22.4
    warning package.json: "dependencies" has dependency "gulp" with range "^3.9.0" that collides with a dependency in "devDependencies" of the same name with version "3.9.1"
    $ gulp serve
    [18:05:44] Failed to load external module @babel/register
    [18:05:44] Requiring external module babel-register
    [18:05:45] Using gulpfile /home/app/supplieson_backend/gulpfile.babel.js
    [18:05:45] Starting 'clean'...
    [18:05:45] Finished 'clean' after 126 ms
    [18:05:45] Starting 'serve'...
    [18:05:45] Starting 'copy'...
    [18:05:45] Starting 'babel'...
    [18:05:45] Finished 'serve' after 200 ms
    [18:05:49] Finished 'copy' after 3.99 s
    [18:05:57] Finished 'babel' after 11 s
    [18:05:57] Starting 'nodemon'...
    [18:05:57] Finished 'nodemon' after 543 ms
    [18:05:57] [nodemon] 2.0.3
    [18:05:57] [nodemon] to restart at any time, enter `rs`
    [18:05:57] [nodemon] watching path(s): *.*
    [18:05:57] [nodemon] watching extensions: js
    [18:05:57] [nodemon] starting `node dist/index.js`


    /home/app/supplieson_backend/node_modules/mongoose/lib/schema/date.js:246
      throw new CastError('date', value, this.path);
      ^
    CastError: Cast to date failed for value "٢٠٢٠-٠٤-٢٤T٢١:٠٦:٠١.٣٠٣Z" at path "createdAt"
        at MongooseError.CastError

(/home/app/supplieson_backend/node_modules/mongoose/lib/error/cast.js:26:11)
        at SchemaDate.cast (/home/app/supplieson_backend/node_modules/mongoose/lib/schema/date.js:246:9)
        at SchemaDate.SchemaType.getDefault (/home/app/supplieson_backend/node_modules/mongoose/lib/schematype.js:587:23)
        at EmbeddedDocument.Document.$__buildDoc (/home/app/supplieson_backend/node_modules/mongoose/lib/document.js:261:22)
        at EmbeddedDocument.Document (/home/app/supplieson_backend/node_modules/mongoose/lib/document.js:62:20)
        at new EmbeddedDocument (/home/app/supplieson_backend/node_modules/mongoose/lib/types/embedded.js:30:12)
        at EmbeddedDocument (/home/app/supplieson_backend/node_modules/mongoose/lib/schema/documentarray.js:27:17)
        at DocumentArray.SchemaArray (/home/app/supplieson_backend/node_modules/mongoose/lib/schema/array.js:65:21)
        at new DocumentArray (/home/app/supplieson_backend/node_modules/mongoose/lib/schema/documentarray.js:46:13)
        at Function.Schema.interpretAsType (/home/app/supplieson_backend/node_modules/mongoose/lib/schema.js:602:14)
        at Schema.path (/home/app/supplieson_backend/node_modules/mongoose/lib/schema.js:547:29)
        at Schema.add (/home/app/supplieson_backend/node_modules/mongoose/lib/schema.js:429:12)
        at new Schema (/home/app/supplieson_backend/node_modules/mongoose/lib/schema.js:100:10)
        at Object.<anonymous> (/home/app/supplieson_backend/dist/server/models/cart.model.js:28:18)
        at Module._compile (module.js:577:32)
        at Object.Module._extensions..js (module.js:586:10)
        at Module.load (module.js:494:32)
        at tryModuleLoad (module.js:453:12)
        at Function.Module._load (module.js:445:3)
        at Module.require (module.js:504:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/home/app/supplieson_backend/dist/server/controllers/cart.controller.js:31:13)
        at Module._compile (module.js:577:32)
        at Object.Module._extensions..js (module.js:586:10)
        at Module.load (module.js:494:32)
        at tryModuleLoad (module.js:453:12)
        at Function.Module._load (module.js:445:3)
        at Module.require (module.js:504:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/home/app/supplieson_backend/dist/server/routes/cart.route.js:23:13)
        at Module._compile (module.js:577:32)
        at Object.Module._extensions..js (module.js:586:10)
        at Module.load (module.js:494:32)
        at tryModuleLoad (module.js:453:12)
        at Function.Module._load (module.js:445:3)
        at Module.require (module.js:504:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/home/app/supplieson_backend/dist/server/routes/index.route.js:27:13)
        at Module._compile (module.js:577:32)
        at Object.Module._extensions..js (module.js:586:10)
        at Module.load (module.js:494:32)
        at tryModuleLoad (module.js:453:12)
        at Function.Module._load (module.js:445:3)
        at Module.require (module.js:504:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/home/app/supplieson_backend/dist/config/express.js:59:14)
        at Module._compile (module.js:577:32)
        at Object.Module._extensions..js (module.js:586:10)
        at Module.load (module.js:494:32)
        at tryModuleLoad (module.js:453:12)
        at Function.Module._load (module.js:445:3)
        at Module.require (module.js:504:17)
    [18:06:01] [nodemon] app crashed - waiting for file changes before starting.

Заранее спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...