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

Preinstall still not aborted in dependencies when using NPM #13

Open
neolitec opened this issue Nov 23, 2022 · 1 comment
Open

Preinstall still not aborted in dependencies when using NPM #13

neolitec opened this issue Nov 23, 2022 · 1 comment

Comments

@neolitec
Copy link

Description

I would like to re-open #2 because the fix doesn't work for me.

I'm on OSX and process.cwd() === /Users/neolitec/.npm/_cacache/tmp/git-clone-15806b2b no matter if I use npm 6, 7, or 8.

process.cwd() doesn't contain node_modules so the package is not detected as a dependency (for which we don't want to check the PM) but actually as the root project.

It works for yarn and pnpm because they don't even seem to trigger the preinstall scripts from the dependencies for some reason.

Reproduction

You can reproduce by creating a new project using NPM and try npm i neolitec/repro-pnpm-project.

@nailuoGG
Copy link

nailuoGG commented Nov 24, 2022

in my case npm i in project-root

process.env.INIT_CWD is project root, but process.cwd() return the node_modules path

{
  cwd: '/Volumes/caseSensitiveDisk/Code/project-xxx/node_modules/@yt/sub-module',
  isInstalledAsDependency: true,
  INIT_CWD: '/Volumes/caseSensitiveDisk/Code/project-xxx',
  PROCESS_CWD: '/Volumes/caseSensitiveDisk/Code/project-xxx/node_modules/@yt/sub-module'
}

const cwd = process.env.INIT_CWD || process.cwd()

so i delete process.env.INIT_CWD,and eveything is ok

env:
node v14.19.3
npm 6.14.17

mergify bot pushed a commit to winglang/wing that referenced this issue Feb 19, 2023
Fixes #1578 by bundling wasi-js so it does not run its own preinstall script. Pretty heavy handed, but not sure what else to do.

The real fix needed is pnpm/only-allow#13

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
sjdemartini added a commit to sjdemartini/mui-tiptap that referenced this issue Sep 14, 2023
Fixes #152. This seems
to be due to a bug in only-allow that specifically affects `npm`, where
the `only-allow` goes into effect even when installing the package as a
dependency: pnpm/only-allow#13
sjdemartini added a commit to sjdemartini/mui-tiptap that referenced this issue Sep 14, 2023
Fixes #152. This seems
to be due to a bug in only-allow that specifically affects `npm`, where
the `only-allow` goes into effect even when installing the package as a
dependency: pnpm/only-allow#13
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.

2 participants