LogansUA / typeorm-seed-extension

TypeORM seed extension
MIT License
4 stars 2 forks source link

Cannot find module '../package' #3

Closed bpatram closed 6 years ago

bpatram commented 6 years ago

Hello, I am unable to run this library because of an import/require error caused because a file that does not exist in the location it is expecting.

Running it causes the following error message:

$ yarn typeorm-seed
yarn run v1.10.1
$ /Volumes/a/b/node_modules/.bin/typeorm-seed
internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '../package'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Volumes/a/b/node_modules/typeorm-seed-extension/cli.js:12:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
error Command failed with exit code 1.

It seems the code here https://github.com/LogansUA/typeorm-seed-extension/blob/master/src/cli.ts#L12

const pkg = require("../package");

attempts to import package.json. While this appears to work in the source code it seems the packaged library puts cli.js in the root of the package's folder.

Manually changing the code I linked to above to be the following fixes the issue :)

const pkg = require("./package");
LogansUA commented 6 years ago

Hi, I'll check it asap, thank you

LogansUA commented 6 years ago

Hi, so actually, the real author of seed functionality is created the seed package, here's the info https://github.com/w3tecch/express-typescript-boilerplate/issues/56#event-1958394344 I encourage you to use it

bpatram commented 6 years ago

I see, should I be using typeorm-seeding instead of this library?

LogansUA commented 6 years ago

Yup I think the real author of this code knows better how to support it :)