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

[BUG] prepare script doesn't see node_modules bin executables #6435

Open
2 tasks done
aovchinn opened this issue May 8, 2023 · 5 comments
Open
2 tasks done

[BUG] prepare script doesn't see node_modules bin executables #6435

aovchinn opened this issue May 8, 2023 · 5 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@aovchinn
Copy link

aovchinn commented May 8, 2023

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I want to have one command to install cli module from git, but it is not possible as prepare step doesn't get node_modules
(cli written with typescript, so it needs npx tsc in the prepare step)

npm i -g git+ssh: ... fails with

'tsc' is not recognized as an internal or external command

Expected Behavior

prepare should take dev and dependencies, and run itself before finishing install
as typescript is listed in dependencies tsc cannot be missing

Steps To Reproduce

repo: https://github.com/aovchinn/test-ssh-git-npm-install/tree/main

  1. In windows
  2. With npm 9
  3. Run 'npm install -g [email protected]:aovchinn/test-ssh-git-npm-install.git'
  4. See error...
PS C:\Users\xxxx\code\test-ssh-git-npm-install> npm install -g [email protected]:aovchinn/test-ssh-git-npm-install.git
npm ERR! code 1
npm ERR! git dep preparation failed timing reifyNode:node_modules/test-ssh-git-n
npm ERR! command C:\Program Files\nodejs\node.exe C:\Users\xxxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\xxxx\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\xxxx\AppData\Local\npm-cache\_cacache\tmp\git-cloneXzSIOZ
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\Windows\system32\cmd.exe /d /s /c npx tsc
npm ERR! npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! npm WARN exec The following package was not found and will be installed: [email protected]
npm ERR! npm ERR! 'tsc' is not recognized as an internal or external command,
npm ERR! npm ERR! operable program or batch file.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:

Environment

  • npm: 9.6.6
  • Node.js: v16.20.0
  • OS Name: win 10
  • System Model Name: ? PC
  • npm config:
; "builtin" config from C:\Users\treovchinn\AppData\Roaming\npm\node_modules\npm\npmrc

prefix = "C:\\Users\\treovchinn\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v16.20.0
; npm local prefix = C:\Users\treovchinn\code\test-ssh-git-npm-install
; npm version = 9.6.6
; cwd = C:\Users\treovchinn\code\test-ssh-git-npm-install
; HOME = C:\Users\treovchinn
; Run `npm config ls -l` to show all defaults.
@aovchinn aovchinn added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels May 8, 2023
@aovchinn
Copy link
Author

aovchinn commented May 9, 2023

did some debugging seems like in rebuild _PACOTE_NO_PREPARE_ flag is not checked
this is inside spawned npm process by node_modules\npm\node_modules\pacote\lib\util\npm.js
you can see that event is prepare - and flag is set on process.env
image

@aovchinn
Copy link
Author

aovchinn commented May 9, 2023

here we can see that node_modules are missing in realpath of this Link type node
image

@aovchinn
Copy link
Author

aovchinn commented May 9, 2023

is it ok to ping isaacs ?
as he added this PACOTE_NO_PREPARE flag
npm/pacote@3d4ccac

@aovchinn
Copy link
Author

aovchinn commented May 9, 2023

could be also this 181eabf

@aovchinn
Copy link
Author

@isaacs @ruyadorno is PACOTE_NO_PREPARE flag required there ?
#6435 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

No branches or pull requests

1 participant