LyteFM commented on issue #264:
URL: https://github.com/apache/couchdb-nano/issues/264#issuecomment-994559412


   I my case, I think it relates to how dependencies are resolved by npm and 
when running `npm ci --production`. I got the error in a NestJS-project where I 
have:
   
   -  `node_modules/jsdom/node_modules/tough-cookie` (version 4.0.0) with 
`"dev": true`
   -  `node_modules/nano/node_modules/tough-cookie` (version 4.0.0) as 
production dependency 
   -  `node_modules/tough-cookie` itself previously resolved with `"version": 
"2.5.0", "dev": true`. (as dependency of `cypress`)
   
   And after explicitly installing `"tough-cookie": 4.0.0`, it works and it 
resolves as:
   
   - `"node_modules/@cypress/request/node_modules/tough-cookie"` with 
`"version": "2.5.0", "dev": true`.
   - `"node_modules/tough-cookie"` with `"version": "4.0.0"` as production 
dependency
   
   
   The error I got looks like the dependency was simply missing in the 
`node_modules`:
   
   ```
   internal/modules/cjs/loader.js:905
   throw err;
    ^
   Error: Cannot find module 'tough-cookie'
   Require stack:
    - .../node_modules/axios-cookiejar-support/lib/interceptors/request.js
    - .../node_modules/axios-cookiejar-support/lib/index.js
   - .../node_modules/nano/lib/nano.js
    - /mymodule/utils/db.js
    - /mymodule/myScript.js
        at Function.Module._resolveFilename 
(internal/modules/cjs/loader.js:902:15)
        at Function.Module._load (internal/modules/cjs/loader.js:746:27)
        at Module.require (internal/modules/cjs/loader.js:974:19)
        at require (internal/modules/cjs/helpers.js:93:18)
        at Object.<anonymous> 
(.../node_modules/axios-cookiejar-support/lib/interceptors/request.js:8:43)
        at Module._compile (internal/modules/cjs/loader.js:1085:14)
        at Object.Module._extensions..js 
(internal/modules/cjs/loader.js:1114:10)
        at Module.load (internal/modules/cjs/loader.js:950:32)
        at Function.Module._load (internal/modules/cjs/loader.js:790:12)
        at Module.require (internal/modules/cjs/loader.js:974:19) {
     code: 'MODULE_NOT_FOUND',
     requireStack: [
       '.../node_modules/axios-cookiejar-support/lib/interceptors/request.js',
       '.../node_modules/axios-cookiejar-support/lib/index.js', 
       '.../node_modules/nano/lib/nano.js',
       '.../mymodule/utils/db.js',
       '.../mymodule/MyScript.js'
    node[5036]:   ]
    node[5036]: }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to