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

Dependencies are not hoisted #277

Open
nicojs opened this issue Apr 4, 2023 · 3 comments
Open

Dependencies are not hoisted #277

nicojs opened this issue Apr 4, 2023 · 3 comments

Comments

@nicojs
Copy link
Contributor

nicojs commented Apr 4, 2023

I've noticed that the dependencies of decktape are never hoisted.

For example:

mkdir tmp && cd tmp
npm i --save-exact decktape@3.7.0
tree node_modules/ -L 3
node_modules/
└── decktape
    ├── node_modules
    │   ├── puppeteer
    │   ├── puppeteer-core
    [...]
    │   └── ylru
    ├── npm-shrinkwrap.json
    ├── package.json
    └── plugins

This is a problem when you later install a version of puppeteer yourself, it gets duplicated in your node_modules:

npm i --save-exact puppeteer-core@19.7.3
tree node_modules/ -L 3
node_modules/
└── decktape
    ├── node_modules
    │   ├── puppeteer # 👈 here
    │   ├── puppeteer-core
    [...]
    ├── package.json
    └── plugins
├── puppeteer # 👈 and here
├── puppeteer-core  
[...]

... which is a problem, because installing 2 versions of puppeteer simultaneously doesn't seem to work:

npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'D:\\a\\1\\s\\node_modules\\decktape\\node_modules\\puppeteer',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'D:\a\1\s\node_modules\decktape\node_modules\puppeteer'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'D:\\a\\1\\s\\node_modules\\decktape\\node_modules\\puppeteer'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'D:\\a\\1\\s\\node_modules\\decktape\\node_modules',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'D:\a\1\s\node_modules\decktape\node_modules\puppeteer'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'D:\\a\\1\\s\\node_modules\\decktape\\node_modules\\puppeteer'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'D:\\a\\1\\s\\node_modules\\decktape',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'D:\a\1\s\node_modules\decktape\node_modules\puppeteer'] {
npm WARN cleanup       errno: -4082,
npm WARN cleanup       code: 'EBUSY',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'D:\\a\\1\\s\\node_modules\\decktape\\node_modules\\puppeteer'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'D:\\a\\1\\s\\node_modules',
npm WARN cleanup     [Error: EBUSY: resource busy or locked, rmdir 'D:\a\1\s\node_modules\decktape\node_modules\puppeteer'] {
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path D:\a\1\s\node_modules\puppeteer

I'm reasonably sure this hoisting behavior is caused by the npm-shrinkwrap.json file. Is this file there by choice? Or can we change it to a package-lock.json file?

@astefanutti
Copy link
Owner

Hi @nicojs, I remember some issues with npm install and package-lock.json, which led to changing to using npm-shrinkwrap.json: #136 (comment).

We can certainly re-assess what's the best option.

@0xDevrim
Copy link

0xDevrim commented Aug 30, 2023

@astefanutti what is the process of installing decktape properly? I don't think decktape installs puppeteer.... Do we have to manually install puppeteer globally?

Error: Could not find Chrome (ver. 115.0.5790.98). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /home/ubuntu/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
    at ChromeLauncher.resolveExecutablePath (file:///usr/lib/node_modules/decktape/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:274:27)
    at ChromeLauncher.executablePath (file:///usr/lib/node_modules/decktape/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:174:25)
    at ChromeLauncher.computeLaunchArguments (file:///usr/lib/node_modules/decktape/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:91:37)
    at async ChromeLauncher.launch (file:///usr/lib/node_modules/decktape/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:53:28)
    at async file:///usr/lib/node_modules/decktape/decktape.js:254:19

@astefanutti
Copy link
Owner

@0xDevrim Chrome is supposed to be installed by Puppeteer when Decktape is installed, e.g., with npm install -g decktape. The Puppeteer runs a post-install script that downloads Chrome and installs it in the cache.

What's the output when you run npm install -g decktape?

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

3 participants