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 install v3.0.0-post from GitHub URL #5660

Closed
vsemozhetbyt opened this issue Apr 16, 2020 · 8 comments · Fixed by #5669
Closed

Cannot install v3.0.0-post from GitHub URL #5660

vsemozhetbyt opened this issue Apr 16, 2020 · 8 comments · Fixed by #5669
Assignees

Comments

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Apr 16, 2020

  • Puppeteer version: v3.0.0-post
  • Platform / OS version: Windows 10 x64
  • URLs (if applicable):
  • Node.js version: v14.0.0-v8-canary20200407ca0d7f295b
j:\temp>npm install -g https://github.com/GoogleChrome/puppeteer
(node:3008) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
(node:1764) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.

> puppeteer@3.0.0-post install C:\Users\vmb\AppData\Roaming\npm\node_modules\puppeteer
> node install.js

Compiling TypeScript before install...
Error running TypeScript Error: Command failed: npm run tsc
(node:1288) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
(node:1144) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
'tsc' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@3.0.0-post tsc: `tsc --version && tsc -p . && cp src/protocol.d.ts lib/ && cp src/externs.d.ts lib/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@3.0.0-post tsc script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\vmb\AppData\Roaming\npm-cache\_logs\2020-04-16T14_48_13_944Z-debug.log

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1051:16)
    at Socket.<anonymous> (internal/child_process.js:442:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:651:12) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'npm run tsc',
  stdout: '\n' +
    '> puppeteer@3.0.0-post tsc C:\\Users\\vmb\\AppData\\Roaming\\npm\\node_modules\\puppeteer\n' +
    '> tsc --version && tsc -p . && cp src/protocol.d.ts lib/ && cp src/externs.d.ts lib/\n' +
    '\n',
  stderr: '(node:1288) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.\n' +
    '(node:1144) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.\n' +
    "'tsc' is not recognized as an internal or external command,\r\n" +
    'operable program or batch file.\r\n' +
    'npm ERR! code ELIFECYCLE\n' +
    'npm ERR! errno 1\n' +
    'npm ERR! puppeteer@3.0.0-post tsc: `tsc --version && tsc -p . && cp src/protocol.d.ts lib/ && cp src/externs.d.ts lib/`\n' +
    'npm ERR! Exit status 1\n' +
    'npm ERR! \n' +
    'npm ERR! Failed at the puppeteer@3.0.0-post tsc script.\n' +
    'npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n' +
    '\n' +
    'npm ERR! A complete log of this run can be found in:\n' +
    'npm ERR!     C:\\Users\\vmb\\AppData\\Roaming\\npm-cache\\_logs\\2020-04-16T14_48_13_944Z-debug.log\n'
}
npm WARN You are using a pre-release version of node and things may not work as expected

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@3.0.0-post install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@3.0.0-post install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\vmb\AppData\Roaming\npm-cache\_logs\2020-04-16T14_48_14_217Z-debug.log
@mathiasbynens
Copy link
Member

mathiasbynens commented Apr 16, 2020

FWIW, I don't have tsc installed globally and npm i puppeteer@latest works for me. So, this is specifically a problem when doing npm i -g https://github.com/GoogleChrome/puppeteer, and not when installing normally.

@jackfranklin could you PTAL?

@vsemozhetbyt
Copy link
Contributor Author

npm i puppeteer@latest is OK for me, but npm i https://github.com/GoogleChrome/puppeteer throws the same errors.

@vsemozhetbyt vsemozhetbyt changed the title Cannot install v3.0.0-post: is TS required now to install? Cannot install v3.0.0-post from GitHub URL Apr 16, 2020
@jackfranklin
Copy link
Collaborator

@vsemozhetbyt thanks for this bug report! I'm looking into this now.

@jackfranklin
Copy link
Collaborator

So it looks like when you install from GitHub npm doesn't do a clone of the repo but still only includes the files you ask it to - so what's happening here is it's not downloading our dependencies or any files we need to enable TypeScript to run. I'm looking into how we can fix this but it might take a bit of time to find the right solution.

In the mean time given the GitHub repo is almost identical to the 3.0.0 release I'd suggest sticking to that version until we can fix this. Sorry for the inconvenience!

jackfranklin added a commit that referenced this issue Apr 17, 2020
The change to the install script to require TypeScript works fine when
installing from npm (because on npm the `lib` directory with the
compiled code already exists) but doesn't if you install from a GitHub
URL. By default it seems npm uses the `files` list when you install from
GitHub which means it's missing a bunch of files that we need to
compile.

Additionally by default when installing from a GitHub URL npm doesn't
install the dependencies which is an issue for us when we need to
compile TypeScript.

The fix is to create a `prepare` script that runs TypeScript if
required. From the npm docs [1]:

> `prepare`: Run both BEFORE the package is packed and published, on
> local npm install without any arguments, and when installing git
> dependencies

And from the npm docs on install [2], it confirms that if a package has
a `prepare` script it is run when installing from GitHub:

> As with regular git dependencies, dependencies and devDependencies
> will be installed if the package has a prepare script, before the
> package is done installing.

Despite having the `prepare` script we still need the TypeScript check
in `install.js` to satisfy the 3rd scenario below where we need to force
a compile:

* If I'm a user installing `puppeteer@X` from npm, the module is
published with the `lib/` directory of compiled code, so I'm set.
* If I'm a user installing Puppeteer from GitHub, the `prepare` script
will run TypeScript for me so I'm set.
* If I'm a developer working on Puppeteer, the `prepare` script also
runs but _after_ `npm install` which means `install.js` fails as it
requires `./lib/helper.js`. So in `install.js` we call
`compileTypeScriptIfRequired` to catch this case.

Fixes #5660.

[1]: https://docs.npmjs.com/misc/scripts
[2]: https://docs.npmjs.com/cli/install
@jackfranklin
Copy link
Collaborator

@vsemozhetbyt please could you try installing from GitHub via this branch? #5660

For me testing that has solved the problem.

mathiasbynens pushed a commit that referenced this issue Apr 17, 2020
The change to the install script to require TypeScript works fine when
installing from npm (because on npm the `lib` directory with the
compiled code already exists) but doesn't if you install from a GitHub
URL. By default it seems npm uses the `files` list when you install from
GitHub which means it's missing a bunch of files that we need to
compile.

Additionally by default when installing from a GitHub URL npm doesn't
install the dependencies which is an issue for us when we need to
compile TypeScript.

The fix is to create a `prepare` script that runs TypeScript if
required. From the npm docs [1]:

> `prepare`: Run both BEFORE the package is packed and published, on
> local npm install without any arguments, and when installing git
> dependencies

And from the npm docs on install [2], it confirms that if a package has
a `prepare` script it is run when installing from GitHub:

> As with regular git dependencies, dependencies and devDependencies
> will be installed if the package has a prepare script, before the
> package is done installing.

Despite having the `prepare` script we still need the TypeScript check
in `install.js` to satisfy the 3rd scenario below where we need to force
a compile:

* If I'm a user installing `puppeteer@X` from npm, the module is
published with the `lib/` directory of compiled code, so I'm set.
* If I'm a user installing Puppeteer from GitHub, the `prepare` script
will run TypeScript for me so I'm set.
* If I'm a developer working on Puppeteer, the `prepare` script also
runs but _after_ `npm install` which means `install.js` fails as it
requires `./lib/helper.js`. So in `install.js` we call
`compileTypeScriptIfRequired` to catch this case.

[1]: https://docs.npmjs.com/misc/scripts
[2]: https://docs.npmjs.com/cli/install

Co-authored-by: Mathias Bynens <mathias@qiwi.be>

Fixes #5660.
@mathiasbynens
Copy link
Member

Update: #5660 has been merged so this can now be tested via npm i https://github.com/GoogleChrome/puppeteer.

@vsemozhetbyt
Copy link
Contributor Author

Unfortunately, it fails for me with a new error:

Microsoft Windows [Version 10.0.18363.628]

>chcp 65001
Active code page: 65001

>node -v
v14.0.0-v8-canary20200415b958dfb8bf

>npm -v
(node:8480) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
(Use `node --trace-deprecation ...` to show where the warning was created)
6.14.4

>npm i https://github.com/GoogleChrome/puppeteer
(node:220) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:9212) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
(Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! prepareGitDep 1>
npm ERR! prepareGitDep > puppeteer@3.0.0-post install C:\Users\vmb\AppData\Roaming\npm-cache\_cacache\tmp\git-clone-78107147
npm ERR! prepareGitDep > node install.js
npm ERR! prepareGitDep
npm ERR! prepareGitDep Puppeteer: Compiling TypeScript...
npm ERR! prepareGitDep
npm ERR! prepareGitDep 2> (node:8592) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
npm ERR! prepareGitDep (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! prepareGitDep npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm WARN deprecated mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! prepareGitDep Error running TypeScript Error: Command failed: npm run tsc
npm ERR! prepareGitDep (node:2608) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
npm ERR! prepareGitDep (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! prepareGitDep (node:3224) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.
npm ERR! prepareGitDep (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! prepareGitDep 'cp' is not recognized as an internal or external command,
npm ERR! prepareGitDep operable program or batch file.
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! puppeteer@3.0.0-post tsc: `tsc --version && tsc -p . && cp src/protocol.d.ts lib/ && cp src/externs.d.ts lib/`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the puppeteer@3.0.0-post tsc script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     C:\Users\vmb\AppData\Roaming\npm-cache\_logs\2020-04-17T13_46_46_993Z-debug.log
npm ERR! prepareGitDep
npm ERR! prepareGitDep     at ChildProcess.exithandler (child_process.js:303:12)
npm ERR! prepareGitDep     at ChildProcess.emit (events.js:315:20)
npm ERR! prepareGitDep     at maybeClose (internal/child_process.js:1051:16)
npm ERR! prepareGitDep     at Socket.<anonymous> (internal/child_process.js:442:11)
npm ERR! prepareGitDep     at Socket.emit (events.js:315:20)
npm ERR! prepareGitDep     at Pipe.<anonymous> (net.js:651:12) {
npm ERR! prepareGitDep   killed: false,
npm ERR! prepareGitDep   code: 1,
npm ERR! prepareGitDep   signal: null,
npm ERR! prepareGitDep   cmd: 'npm run tsc',
npm ERR! prepareGitDep   stdout: '\n' +
npm ERR! prepareGitDep     '> puppeteer@3.0.0-post tsc C:\\Users\\vmb\\AppData\\Roaming\\npm-cache\\_cacache\\tmp\\git-clone-78107147\n' +
npm ERR! prepareGitDep     '> tsc --version && tsc -p . && cp src/protocol.d.ts lib/ && cp src/externs.d.ts lib/\n' +
npm ERR! prepareGitDep     '\n' +
npm ERR! prepareGitDep     'Version 3.8.3\r\n',
npm ERR! prepareGitDep   stderr: '(node:2608) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.\n' +
npm ERR! prepareGitDep     '(Use `node --trace-deprecation ...` to show where the warning was created)\n' +
npm ERR! prepareGitDep     '(node:3224) [DEP0139] DeprecationWarning: Calling process.umask() with no arguments is prone to race conditions and is a potential security vulnerability.\n' +
npm ERR! prepareGitDep     '(Use `node --trace-deprecation ...` to show where the warning was created)\n' +
npm ERR! prepareGitDep     "'cp' is not recognized as an internal or external command,\r\n" +
npm ERR! prepareGitDep     'operable program or batch file.\r\n' +
npm ERR! prepareGitDep     'npm ERR! code ELIFECYCLE\n' +
npm ERR! prepareGitDep     'npm ERR! errno 1\n' +
npm ERR! prepareGitDep     'npm ERR! puppeteer@3.0.0-post tsc: `tsc --version && tsc -p . && cp src/protocol.d.ts lib/ && cp src/externs.d.ts lib/`\n' +
npm ERR! prepareGitDep     'npm ERR! Exit status 1\n' +
npm ERR! prepareGitDep     'npm ERR! \n' +
npm ERR! prepareGitDep     'npm ERR! Failed at the puppeteer@3.0.0-post tsc script.\n' +
npm ERR! prepareGitDep     'npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n' +
npm ERR! prepareGitDep     '\n' +
npm ERR! prepareGitDep     'npm ERR! A complete log of this run can be found in:\n' +
npm ERR! prepareGitDep     'npm ERR!     C:\\Users\\vmb\\AppData\\Roaming\\npm-cache\\_logs\\2020-04-17T13_46_46_993Z-debug.log\n'
npm ERR! prepareGitDep }
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! puppeteer@3.0.0-post install: `node install.js`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR!
npm ERR! prepareGitDep npm ERR! Failed at the puppeteer@3.0.0-post install script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     C:\Users\vmb\AppData\Roaming\npm-cache\_logs\2020-04-17T13_46_47_079Z-debug.log
npm ERR! prepareGitDep
npm ERR! premature close

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\vmb\AppData\Roaming\npm-cache\_logs\2020-04-17T13_46_47_267Z-debug.log

@vsemozhetbyt
Copy link
Contributor Author

vsemozhetbyt commented May 8, 2020

Still the same errors with puppeteer@3.0.4.

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

Successfully merging a pull request may close this issue.

3 participants