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

Cannot find module 'puppeteer' with yarn global #123

Closed
awattez opened this issue Nov 28, 2021 · 10 comments
Closed

Cannot find module 'puppeteer' with yarn global #123

awattez opened this issue Nov 28, 2021 · 10 comments

Comments

@awattez
Copy link

awattez commented Nov 28, 2021

I cannot perform the pdf command if I use sensei after installing it using yarn global add

➜  node -v
v14.17.3

➜ yarn -v
1.22.17

➜  yarn global add https://github.com/Zenika/sensei
yarn global v1.22.17
[1/4] 🔍  Resolving packages...
info There appears to be trouble with your network connection. Retrying...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "serverless > @serverless/components > inquirer-autocomplete-prompt@1.3.0" has unmet peer dependency "inquirer@^5.0.0 || ^6.0.0 || ^7.0.0".
[4/4] 🔨  Building fresh packages...
success Installed "@zenika/sensei@1.0.0" with binaries:
      - sensei
✨  Done in 43.99s


➜  sensei pdf
Processing folder '/Users/awattez/Documents/kafka/workshop-kafka-developper' as 'workshop-kafka-developper' using slide size 1420x800 and language en
Generate pdf slides & labs
Build slides & labs
Files generated to dist folder
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module '/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/node_modules/decktape/decktape.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/bin/sensei.js:157
  throw err;
  ^

Error: spawned process exited with non-zero code '1'
    at ChildProcess.<anonymous> (/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/bin/sensei.js:96:11)
    at ChildProcess.emit (events.js:375:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'puppeteer'
Require stack:
- /Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.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:92:18)
    at Object.<anonymous> (/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.js:3:19)
    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:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.js'
  ]
}
@awattez
Copy link
Author

awattez commented Nov 29, 2021

➜  uname -a
Darwin MacBook-Pro-de-adrien.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May  8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64

@hgwood
Copy link
Member

hgwood commented Nov 29, 2021

Hi! Is it possible that you tried this before #121 was merged? The error message makes me think so. If so, could you retry with the latest version (main branch)?

@awattez
Copy link
Author

awattez commented Dec 1, 2021

Clean install same error

➜  yarn global remove @zenika/sensei
➜  yarn --verbose global add https://github.com/Zenika/sensei
➜  sensei pdf
...
...
...
- /Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.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:92:18)
    at Object.<anonymous> (/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.js:3:19)
    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:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.js'
  ]
}

@hgwood
Copy link
Member

hgwood commented Dec 6, 2021

Could you give me the full log from running sensei pdf?

@awattez
Copy link
Author

awattez commented Dec 8, 2021

➜  workshop-kafka-developper git:(master) sensei --version
1.0.0
➜  workshop-kafka-developper git:(master) sensei pdf
Processing folder '/Users/awattez/Documents/kafka/workshop-kafka-developper' as 'workshop-kafka-developper' using slide size 1420x800 and language en
Generate pdf slides & labs
Build slides & labs
Files generated to dist folder
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module '/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/node_modules/decktape/decktape.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/bin/sensei.js:157
  throw err;
  ^

Error: spawned process exited with non-zero code '1'
    at ChildProcess.<anonymous> (/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/bin/sensei.js:96:11)
    at ChildProcess.emit (events.js:375:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'puppeteer'
Require stack:
- /Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.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:92:18)
    at Object.<anonymous> (/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.js:3:19)
    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:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/pdf.js'
  ]
}

@hgwood
Copy link
Member

hgwood commented Dec 9, 2021

You're definitely still running an old version of sensei,

This line

Error: Cannot find module '/Users/awattez/.nvm/versions/node/v14.17.3/lib/node_modules/@zenika/sensei/src/pdf/node_modules/decktape/decktape.js'

indicates that the pdf module is independent in the version you're running (it has its own node_modules folder), which is no longer the case since #121.

Yarn is probably reinstalling from cache instead of fetching the newer version. You might be hitting some form of this yarn issue. Could you try cleaning your cache?

➜  yarn global remove @zenika/sensei
➜  yarn cache clean
➜  yarn --verbose global add https://github.com/Zenika/sensei

The issue suggests that this might be fixed by using a different syntax to point at the package. I'm going to test if I can find a syntax that works.

@hgwood
Copy link
Member

hgwood commented Dec 9, 2021

I confirm that I cannot reproduce the issue when specifying a branch or commit (eg .../sensei#branch), though I can't confirm I would experience the issue without it because I would need to move main to do that. So maybe you could try yarn global add https://github.com/Zenika/sensei#main?

@awattez
Copy link
Author

awattez commented Dec 17, 2021

Switch to Node 16

➜  node -v
v16.13.1
➜  npm -v
8.1.2

Install with yarn :

➜  yarn global remove @zenika/sensei
➜  yarn cache clean
# yarn --verbose global add https://github.com/Zenika/sensei
➜  yarn global add https://github.com/Zenika/sensei\#main

Same error:

➜  workshop-kafka-developper git:(master) sensei pdf
Processing folder '/Users/awattez/Documents/kafka/workshop-kafka-developper' as 'workshop-kafka-developper' using slide size 1420x800 and language 'en'
Generate pdf slides & labs
Build slides & labs
Files generated to dist folder
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/Users/awattez/.config/yarn/global/node_modules/@zenika/sensei/node_modules/decktape/decktape.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
/Users/awattez/.config/yarn/global/node_modules/@zenika/sensei/bin/sensei.js:165
  throw err;
  ^

Error: spawned process exited with non-zero code '1'
    at ChildProcess.<anonymous> (/Users/awattez/.config/yarn/global/node_modules/@zenika/sensei/bin/sensei.js:104:11)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
➜  workshop-kafka-developper git:(master) Done!

Install with node/mpm:

➜  yarn global remove @zenika/sensei
➜  yarn cache clean
➜  npm install --global https://github.com/Zenika/sensei

Sensei pdf works

➜  workshop-kafka-developper git:(master) sensei pdf
Processing folder '/Users/awattez/Documents/kafka/workshop-kafka-developper' as 'workshop-kafka-developper' using and language 'en'
Generate pdf slides & labs
Build slides & labs
Files generated to dist folder
Loading page file:/Users/awattez/Documents/kafka/workshop-kafka-developper/dist/slides.html ...
Done!
PDF labs generated
Loading page finished with status: 0
Reveal JS plugin activated
Printing slide #/10/15  (275/275) ...
Printed 275 slides
PDF slides generated

Maybe not recommend to install globally sensei with yarn.

@awattez awattez closed this as completed Dec 17, 2021
@hgwood
Copy link
Member

hgwood commented Dec 17, 2021

I'd be interested to know if yarn global add https://github.com/Zenika/sensei#main works or not :)

hgwood added a commit that referenced this issue Dec 17, 2021
@awattez
Copy link
Author

awattez commented Dec 17, 2021

My bad, i'v used yarn global add https://github.com/Zenika/sensei\#main bad copy-paste in my previous comments.

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

2 participants