Node sdk v3.1.3 error package parse-duration

With Couchbase Node sdk v3.1.3 I get this error:

SyntaxError: Invalid regular expression: /(-?(?:\d+\.?\d*|\d*\.?\d+)(?:e[-+]?\d+)?)\s*([\p{L}]*)/: Invalid escape
    at Object.<anonymous> (/home/ubuntu/api-couchbase/node_modules/parse-duration/index.js:3:18)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at Module.Hook._require.Module.require (/home/ubuntu/.nvm/versions/node/v8.12.0/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/ubuntu/api-couchbase/node_modules/couchbase/lib/utils.js:4:23)

The error comes from the parse-duration package “^1.0.0”. It works fine with “^0.4.4”
Node js version 8.12.0

Hi @losapevo I created a new project using 3.1.3 and was able to connect to cluster and create a bucket.
I am using macOS.

Anything in particular that you are trying to do that is causing this error ? Did you try cleaning up the node_modules folder?

Hi @AV25242
I tried deleting node_modules but still have the same error. Works fine with v3.1.1 because requires parse-duration v0.4.4, but v3.1.3 requires parse-duration v1.0.0 and that is when I get the error.
I am using macOS too with Node.js v8.12.0

ah ok the only difference you and I have is I am using a later version of Node 12.x
I am going to downgrade and see what happens

Looks like node version and parse-duration version issue.
Yeah I get the error you are getting. I will report it back to the team. Probably the support version of Node that current says greater than 8.0.0 needs to be changed.

Meanwhile can you upgrade to latest Node version ? I was on Node 12.x before I downgraded and it worked. Also looks like
Node 8 is no longer supported and has reached End Of Life. Update Now! Node.js 8 is Not Supported from 2020 | @RisingStack

Created an internal ticket
This is not going to solve problems with Node 8, you will still have to update Node version. This is more to update the Nodejs SDK version dependencies (minimum requirements)

Thank you. I chose to update Node version. Sooner or later it was something I have to deal with :grimacing:

1 Like