Skip to content

Cannot find module 'pg-native' #2165

Closed
Closed
@emahuni

Description

@emahuni

I have seen this error many times when my app errs for some reason or another as long as there is data that has something to do with the knex or bookshelf module. Other modules in this case have nothing to do with this per se as the source for this library clearly requires pg-native, but doesn't declare it in its package.json anywhere. Here is stack trace and source where it is being required.

Stack trace:

Cannot find module 'pg-native'
Require stack:
- /home/em/project/api/node_modules/pg/lib/native/client.js
- /home/em/project/api/node_modules/pg/lib/native/index.js
- /home/em/project/api/node_modules/pg/lib/index.js
- /home/em/project/api/node_modules/strapi-connector-bookshelf/lib/knex.js
- /home/em/project/api/node_modules/strapi-connector-bookshelf/lib/index.js
- /home/em/project/api/node_modules/strapi-database/lib/require-connector.js
- /home/em/project/api/node_modules/strapi-database/lib/database-manager.js
- /home/em/project/api/node_modules/strapi-database/lib/index.js
- /home/em/project/api/node_modules/strapi/lib/Strapi.js
- /home/em/project/api/node_modules/strapi/lib/index.js
- /home/em/project/api/node_modules/strapi/lib/commands/develop.js
- /home/em/project/api/node_modules/strapi/bin/strapi.js

Source referred to by top-most (throwing) line from this module:

cat /home/em/project/api/node_modules/pg/lib/native/client.js
'use strict'
/**
 * Copyright (c) 2010-2017 Brian Carlson (brian.m.carlson@gmail.com)
 * All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * README.md file in the root directory of this source tree.
 */

// eslint-disable-next-line
var Native = require('pg-native')

The supposed eslint error and warning is disabled showing this maybe desired, but is causing errors upstream.

Here is the package.json dependency section for this module:

"dependencies": {
    "buffer-writer": "2.0.0",
    "packet-reader": "1.0.0",
    "pg-connection-string": "0.1.3",
    "pg-packet-stream": "^1.1.0",
    "pg-pool": "^2.0.10",
    "pg-types": "^2.1.0",
    "pgpass": "1.x",
    "semver": "4.3.2"
  },
  "devDependencies": {
    "async": "0.9.0",
    "bluebird": "3.5.2",
    "co": "4.6.0",
    "eslint": "^6.0.1",
    "eslint-config-standard": "^13.0.1",
    "eslint-plugin-import": "^2.18.1",
    "eslint-plugin-node": "^9.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "pg-copy-streams": "0.3.0"
  },

Can/should this be corrected in this module by adding pg-native in dependancies?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions