Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Please install tedious package manually #11168

Closed
2 of 7 tasks
mostafa8026 opened this issue Jul 9, 2019 · 12 comments
Closed
2 of 7 tasks

Error: Please install tedious package manually #11168

mostafa8026 opened this issue Jul 9, 2019 · 12 comments

Comments

@mostafa8026
Copy link

mostafa8026 commented Jul 9, 2019

What are you doing?

using the pkg (npm pacckager) and create an exe package.

// A simple tedious application

To Reproduce
Steps to reproduce the behavior:
1- create a simple node application with tedious
2- npm install -g pkg
3- pkg -t win-x64 index.js -o apptedious
4- apptedious

What do you expect to happen?

Run without any error.

What is actually happening?

Error: Please install tedious package manually

Environment

Dialect:

  • mysql
  • postgres
  • sqlite
  • mssql
  • any
    Dialect **tedious ** version:6.2.0
    Database version: mssql 2016
    Sequelize version: 5.9.4
    Node Version: 8.11.3
    OS: Windows 10
    If TypeScript related: TypeScript version: XXX
    Tested with latest release:
  • No
  • Yes, specify that version: 5.9.4
@papb
Copy link
Member

papb commented Jul 10, 2019

I don't think this is a problem with sequelize. It is more likely to be a problem with pkg (or you did something wrong).

Are you sure tedious is in your package.json?

@mostafa8026
Copy link
Author

mostafa8026 commented Jul 10, 2019

Yes, I'm sure.

@mostafa8026
Copy link
Author

It is my dependencies:
"dependencies": {
"chalk": "^2.4.2",
"cli-progress": "^2.1.1",
"cliui": "^5.0.0",
"delay": "^4.3.0",
"json-diff": "^0.5.4",
"request-promise": "^4.2.4",
"sequelize": "^5.9.4",
"tty-table": "^2.7.1",
"xml2js": "^0.4.19",
"yargs": "^13.2.4",
"tedious": "^6.2.0"
}

@papb
Copy link
Member

papb commented Jul 10, 2019

Can you try using pkg with the -b option?

-b, --build don't download prebuilt base binaries, build them

If that doesn't work, can you try using nexe instead of pkg?

@mostafa8026
Copy link
Author

pkg -b cause this error:

$ pkg -b -t win-x64 index.js -o sync
> pkg@4.4.0
> Building base binary from source:
  built-v8.16.0-win-x64
> Cloning Node.js repository from GitHub...
  git                          [====================] 100%
> Checking out v8.16.0
> Applying patches

> Error! Error: spawn patch ENOENT
    at _errnoException (util.js:992:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

nexe does not encounter with the Please install tedious package manually error, but it cause another error:

TypeError: Cannot read property 'getServerCounter' of undefined

which the getServerCounter is one of my functions.
consider that the program works correctly without packaging.

@papb
Copy link
Member

papb commented Jul 12, 2019

Hmm... I am starting to believe that this is being caused by the dynamic require call to tedious by sequelize. Pkg does not solve this automatically, but it can be solved manually.

Please take a look at the following:

Let me know if from these you can solve your problem.

@mostafa8026
Copy link
Author

mostafa8026 commented Jul 12, 2019

Thanks a lot, I solved the problem with referencing the needed stuff in assets and scripts like follow:

"bin": "index.js",
"pkg": {
    "scripts": ["node_modules/tedious/lib/tedious.js", "models/*.js"],
    "assets": ["config/log.json"]
  }

and then execute this pkg commad:

pkg -t win-x64 package.json -o app-name

@papb
Copy link
Member

papb commented Jul 12, 2019

Nice 😬

Can you close the issue?

@mostafa8026
Copy link
Author

OFCOURSEEEEEE

@LiamKarlMitchell
Copy link

Was getting this error when trying to use sequelize-auto.
Installing tedious globally seems to resolve it...

npm install -g tedious sequelize-auto
sequelize-auto -o "./models" -d databasenameHere -h hostnameHere -u usernameHere -p portHere -x passwordHere -e mssql

@JonLopezGarcia
Copy link

I had this issue when building my node server app and bundling all the dependencies in a single file.

Webpack was unable to guess that my app was depending on tedious therefore not bundling with the rest of my dependencies.
I solved the issue by providing the tedious module in the sequelize configuration like so :

import * as tedious from 'tedious';
...
const db = new Sequelize({
  dialect: 'mssql',
  dialectModule: tedious,
  ...
});

By writing a static import Webpack embeds the tedious module in the bundle 🚀

Official documentation here ; Search for dialectModule option

@papb
Copy link
Member

papb commented Apr 4, 2021

Hi @JonLopezGarcia, great that you figured it out. Maybe you can help me with #13169 as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants