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

Not running build script when installing via git #5826

Closed
7v0lk0v opened this issue Dec 23, 2022 · 1 comment · Fixed by #5837
Closed

Not running build script when installing via git #5826

7v0lk0v opened this issue Dec 23, 2022 · 1 comment · Fixed by #5837
Assignees
Milestone

Comments

@7v0lk0v
Copy link

7v0lk0v commented Dec 23, 2022

When installing modules via git, pnpm doesn't run the build script (but npm does) resulting in misleading error messages such as "module not found" even though the module is there.

pnpm version:

7.19.0

Code to reproduce the issue:

pnpm init
pnpm add https://github.com/unjs/consola.git
node -r consola

node:internal/modules/cjs/loader:367
      throw err;
      ^

Error: Cannot find module '/home/gv/wk/bdp/consola/t3/node_modules/consola/dist/consola.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:359:19)
    at Module._findPath (node:internal/modules/cjs/loader:572:18)
    at Module._resolveFilename (node:internal/modules/cjs/loader:932:27)
    at Module._load (node:internal/modules/cjs/loader:787:27)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at Module._preloadModules (node:internal/modules/cjs/loader:1289:12)
    at loadPreloadModules (node:internal/bootstrap/pre_execution:558:5)
    at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:95:3)
    at node:internal/main/repl:19:1 {
  code: 'MODULE_NOT_FOUND',
  path: '/home/gv/wk/bdp/consola/t3/node_modules/consola/package.json',
  requestPath: 'consola'
}

Node.js v18.4.0
>

Expected behavior:

npm init -y
npm add https://github.com/unjs/consola.git
node -r consola
Welcome to Node.js v18.4.0.
Type ".help" for more information.
>

Actual behavior:

See above.

Additional information:

  • node -v prints: v18.4.0

  • Windows, macOS, or Linux?: Linux

@7v0lk0v
Copy link
Author

7v0lk0v commented Jan 4, 2023

thanks for the lightning quick fix 🥇

stefanmaric added a commit to MasterworksIO/eslint-config-masterworks that referenced this issue Jan 10, 2023
Version v7.20.0 of pnpm introduced a change that makes it run our
publish script on install, breaking CI pipelines and local envs
alike.

See: pnpm/pnpm#5837
See: pnpm/pnpm#5826
See: https://github.com/pnpm/pnpm/releases/tag/v7.20.0

On environments where the pnpm store is cached, doing a second pnpm
install solves the issue. These doesn't work in envs like Docker tho.

Could be fixed by adding a `main` field to the top-level package.json
as version v7.22.0 added a check for that.

See: https://github.com/pnpm/pnpm/releases/tag/v7.22.0
See: pnpm/pnpm#5868

But since we are not really publishing these packages we can just
remove the script.

[f:2h]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants