Fails only if the build command was executed with postinstall
Describe the bug
I'm writing a rules package for a tool called textlint in monorepo. There are packages in "packages" with the build command set to "postinstall", but when I try to install the dependencies, it fails.
TypeError: Method get TypedArray.prototype.length called on incompatible receiver [object Object]
│ at get length [as length] (<anonymous>)
│ at _0x2290eb (https://stackblitzstarterswije7f-nlli.w-credentialless.staticblitz.com/blitz.c53ab388.js:37:266369)
│ at https://stackblitzstarterswije7f-nlli.w-credentialless.staticblitz.com/blitz.c53ab388.js:37:267155
│ at Array.forEach (<anonymous>)
│ at _flushBuffer (https://stackblitzstarterswije7f-nlli.w-credentialless.staticblitz.com/blitz.c53ab388.js:37:26714…
│ at Map.forEach (<anonymous>)
│ at _0x346633 (https://stackblitzstarterswije7f-nlli.w-credentialless.staticblitz.com/blitz.c53ab388.js:37:265677)
│ at https://stackblitzstarterswije7f-nlli.w-credentialless.staticblitz.com/blitz.c53ab388.js:42:407467
│ at Object.spawn (https://stackblitzstarterswije7f-nlli.w-credentialless.staticblitz.com/blitz.c53ab388.js:42:40758…
│ at Object.spawnSync (https://stackblitzstarterswije7f-nlli.w-credentialless.staticblitz.com/blitz.c53ab388.js:35:1…
│ ELIFECYCLE Command failed with exit code 1.
However, if the build command is executed as follows, it completes without problems.
pnpm run -r postinstall
or
cd packages/textlint-rule-example
pnpm postinstall
Link to the blitz that caused the error
https://stackblitz.com/edit/stackblitz-starters-wije7f
Steps to reproduce
Just open blitz.
Expected behavior
The build completes without outputting any errors.
Parity with Local
- [X] I have run the project in my local machine and I could not reproduce the issue.
Screenshots
No response
Platform
- OS: Windows 11
- Browser: Chrome, Firefox
- Version:
- Chrome 114.0.5735.199
- Firefox 116.0b6
Additional context
When pnpm install is executed, an error is displayed, but the build process itself seems to complete successfully.
Hi! :wave: Thanks for reporting the issue!
when I run the project locally (not in WebContainer) I get;
Lockfile is up to date, resolution step is skipped
Already up to date
packages/textlint-rule-example postinstall$ pnpm build
│ > [email protected] build /home/cake/wfh/webcontainer/e2e/fixtures/aaaa/textlint/packages/textlint-rule-example
│ > textlint-scripts build
│ ../../../../../../node_modules/@types/express-serve-static-core/index.d.ts(589,18): error TS2430: Interface 'Response<ResBod
[1 lines collapsed]
│ Type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>> | undefined' is not assignable to type 'Incomin
│2 Type 'undefined' is not assignable to type 'IncomingMessage'.
Because of this I've not been able to confirm that this is an issue with WebContainer
Can you confirm it definitely works locally for you? Is there something else I need to do to get it to work?
Thanks for confirming this!
This is working fine in my local environment. The local node.js and pnpm versions are the same as those used in WebContainer.
> node -v
v16.20.0
> pnpm -v
8.6.3
> pnpm install
Scope: all 2 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +420
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /home/hiratake/.local/share/pnpm/store/v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 420, reused 418, downloaded 2, added 420, done
packages/textlint-rule-example postinstall$ pnpm build
│ > [email protected] build /home/hiratake/workspace/monorepo/packages/textlint-rule-example
│ > textlint-scripts build
│ Successfully compiled 1 file with Babel (382ms).
└─ Done in 3s
Done in 5.2s
I have a repository of my website with the same problem.
This repository is installing dependencies within a GitHub Actions workflow. In this case, the build still completes successfully. However, it fails in WebContainer.
https://github.com/Hiratake/hiratake-web https://stackblitz.com/~/github.com/Hiratake/hiratake-web
Thanks for the updated links. I still cannot get the original version to install locally, but the hiratake-web repo works locally for me and has this issue in WebContainer
We're tracking this issue internally and will post updates about it when we have them.