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

Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-arm64-musl. #152

Open
mkhvoiko opened this issue Aug 11, 2023 · 17 comments

Comments

@mkhvoiko
Copy link

Hello,
We have a problem with running gatsby build in pipeline on linux VMs and in Docker.
It works only if i run gatsby build locally on my mac with m1.
It doesnt work on my mac if i try to run build in docker.
It doesnt work in pipeline - both in script and in docker.
I tried different base images with different node versions. I tried to run in pipeline with ubuntu 22 - the same result.
Dockerfile:
FROM node:18.4.0-buster-slim RUN apt-get update && apt-get install -y python3 build-essential gcc g++ make RUN npm install -g gatsby-cli COPY . . RUN npm ci RUN gatsby build
Inside the container i see node_modules with @parcel/watcher and all files #151

@mkhvoiko
Copy link
Author

` ERROR #11903 API.TYPESCRIPT.COMPILATION

There was an unhandled error during compilation for /. Please run the command with the --verbose flag again.
No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-arm64-glibc. Please ensure it is installed (don't use --no-optional when installing with npm).
Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.

Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-arm64-glibc. Please ensure it is installed (don't use --no-optional when installing with
npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.

  • index.js:25 Object.
    /node_modules/@parcel/watcher/index.js:25:13

  • loader:1112 Module._compile
    node:internal/modules/cjs/loader:1112:14

  • loader:1166 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1166:10

  • loader:988 Module.load
    node:internal/modules/cjs/loader:988:32

  • loader:834 Function.Module._load
    node:internal/modules/cjs/loader:834:12

  • loader:1012 Module.require
    node:internal/modules/cjs/loader:1012:19

  • helpers:102 require
    node:internal/modules/cjs/helpers:102:18

  • index.js:7 Object.
    /node_modules/@parcel/fs/lib/index.js:7:28

  • loader:1112 Module._compile
    node:internal/modules/cjs/loader:1112:14

  • loader:1166 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1166:10

  • loader:988 Module.load
    node:internal/modules/cjs/loader:988:32

  • loader:834 Function.Module._load
    node:internal/modules/cjs/loader:834:12

  • loader:1012 Module.require
    node:internal/modules/cjs/loader:1012:19

  • helpers:102 require
    node:internal/modules/cjs/helpers:102:18

  • LMDBCache.js:49 _fs
    /node_modules/@parcel/cache/lib/LMDBCache.js:49:16

  • LMDBCache.js:79 new LMDBCache
    /node_modules/@parcel/cache/lib/LMDBCache.js:79:20

not finished compile gatsby files - 0.101s`

@devongovett
Copy link
Member

The package exists https://www.npmjs.com/package/@parcel/watcher-linux-arm64-musl but for some reason (perhaps an npm bug) it may not have been installed properly? Try clearing your package-lock.json and deleting node modules and then re installing. npm/cli#4828

@Kureev
Copy link

Kureev commented Aug 26, 2023

Can confirm the same thing as the topic starter.

Build log:

 > [builder 5/5] RUN yarn build:
#0 0.501 yarn run v1.22.19
#0 0.553 $ yarn build:sdk && yarn build:hosted
#0 0.798 $ yarn workspace @novoic/storyteller build --log-level=warn
#0 1.365 $ parcel build src/index.tsx --log-level=warn
#0 1.688 Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-x64-musl. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.
#0 1.688     at Object.<anonymous> (/app/node_modules/@parcel/watcher/index.js:23:13)
#0 1.688     at Module._compile (node:internal/modules/cjs/loader:1159:14)
#0 1.688     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
#0 1.688     at Module.load (node:internal/modules/cjs/loader:1037:32)
#0 1.688     at Module._load (node:internal/modules/cjs/loader:878:12)
#0 1.688     at Module.require (node:internal/modules/cjs/loader:1061:19)
#0 1.688     at require (node:internal/modules/cjs/helpers:103:18)
#0 1.688     at Object.<anonymous> (/app/node_modules/@parcel/fs/lib/index.js:7:28)
#0 1.688     at Module._compile (node:internal/modules/cjs/loader:1159:14)
#0 1.688     at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
#0 1.815 error Command failed with exit code 1.
#0 1.815 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#0 1.840 error Command failed.
#0 1.840 Exit code: 1
#0 1.840 Command: /usr/local/bin/node
#0 1.840 Arguments: /opt/yarn-v1.22.19/lib/cli.js build --log-level=warn
#0 1.840 Directory: /app/packages/storyteller
#0 1.840 Output:
#0 1.840
#0 1.841 info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
#0 1.867 error Command failed with exit code 1.
#0 1.867 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#0 1.893 error Command failed with exit code 1.
#0 1.893 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
Dockerfile:21
--------------------
  19 |     RUN yarn install
  20 |
  21 | >>> RUN yarn build
  22 |
  23 |     FROM nginx:1.23.0-alpine

Used node:18-alpine3.15 as base image. Would appreciate any solutions. At this point it seems that downgrading is the only option

@devongovett
Copy link
Member

devongovett commented Aug 26, 2023

Did you follow the instructions in the error message? I can't do anything about npm/yarn not installing things properly. Things to try:

  • Verify that the package actually does not exist in your node_modules
  • Verify that you are not installing with --no-optional (npm) or --ignore-optional (yarn)
  • Check that the missing package is listed in your lock file. If not, delete your lock file and node_modules and re-install.

@rogermparent
Copy link

rogermparent commented Sep 6, 2023

I just had this issue except with @parcel/watcher-linux-arm-glibc using a Raspberry Pi 4 running Raspberry Pi OS, based on Debian Bullseye.
I decided to try using require in the Node REPL to see if it works, and found a more descriptive error: couldn't find glibc 2.32. I checked my system and found I had glibc 2.31 available in the repos. One format to Ubuntu later and I had glibc ~2.37 available and the error is fixed.

Some possibly helpful takeaways from my experience:

  • It seems like the new parcel/watcher distribution system can fail with this Error: No prebuild or local build error and squash a more descriptive error message
  • The new system depends on glibc 2.32, such that some stability-focused distros like Debian can't run it, so check the availability of your repos. Buster is before Bullseye, so you might be hit by the same issue. There may be something similar with musl.
  • You might be able to get a more descriptive error message by using require on the package in question in the REPL or another dummy environment.

Hope this helps you and/or someone else in the future!

@rogermparent
Copy link

rogermparent commented Sep 6, 2023

Just popped into the code and I found where the message is logged, and indeed parcel will simply log this message in a catch block regardless of why the require failed.

Maybe right off we could tweak the verbiage of the message to something like Error: Failed to load prebuild, and beyond that maybe pass along messages from the caught error? From there it'll be much easier for users to diagnose whatever their own issue is.

@estromenko
Copy link

Facing the same issue with @parcel/watcher-linux-x64-musl package. Downgrade of parcel or watcher packages did not help

@felixhauptmann
Copy link

felixhauptmann commented Sep 9, 2023

I just had this issue except with @parcel/watcher-linux-arm-glibc using a Raspberry Pi 4 running Raspberry Pi OS, based on Debian Bullseye. I decided to try using require in the Node REPL to see if it works, and found a more descriptive error: couldn't find glibc 2.32. I checked my system and found I had glibc 2.31 available in the repos. One format to Ubuntu later and I had glibc ~2.37 available and the error is fixed.

Some possibly helpful takeaways from my experience:

  • It seems like the new parcel/watcher distribution system can fail with this Error: No prebuild or local build error and squash a more descriptive error message
  • The new system depends on glibc 2.32, such that some stability-focused distros like Debian can't run it, so check the availability of your repos. Buster is before Bullseye, so you might be hit by the same issue. There may be something similar with musl.
  • You might be able to get a more descriptive error message by using require on the package in question in the REPL or another dummy environment.

Hope this helps you and/or someone else in the future!

I recently ran into a similar issue on a netlify container. We (temporarily) resolved it by manually adding '@parcel/watcher-linux-x64-glibc' as an optional dependency.

@estromenko
Copy link

Facing the same issue with @parcel/watcher-linux-x64-musl package. Downgrade of parcel or watcher packages did not help

Solved the problem upgrading alpine from 3.15 to 3.18.

To reproduce the issue run commands below (the second one is failing)

docker run --rm -it node:18-alpine3.18 sh -c "yarn add parcel && echo 123 >> index.tsx && yarn parcel build index.tsx"
docker run --rm -it node:18-alpine3.15 sh -c "yarn add parcel && echo 123 >> index.tsx && yarn parcel build index.tsx"

@dgadelha
Copy link

Why is a filesystem watcher needed to do an one-shot build of a project?

@mischnic
Copy link
Member

This package also allows detecting changes between one-shot builds: https://github.com/parcel-bundler/watcher#querying

@shamsup
Copy link

shamsup commented Dec 30, 2023

I experienced this issue using the electron-forge typescript-webpack template trying to use @parcel/watcher at runtime.

The error message reported the correct package name, however, inspecting the build output showed webpack was only interpreting the name to require as -glibc instead of appending that to the existing name.

[electron] Error: Cannot find module '-glibc'
[electron]     at webpackMissingModule (/home/shamsup/projects/electron-test/.webpack/main/index.js:27:82)

I am not familiar enough with webpack internals to explain why it misinterprets the require, but this patch resolved the issue (patch-package):

diff --git a/node_modules/@parcel/watcher/index.js b/node_modules/@parcel/watcher/index.js
index 4929c54..64dd688 100644
--- a/node_modules/@parcel/watcher/index.js
+++ b/node_modules/@parcel/watcher/index.js
@@ -4,9 +4,9 @@ let name = `@parcel/watcher-${process.platform}-${process.arch}`;
 if (process.platform === 'linux') {
   const { MUSL, family } = require('detect-libc');
   if (family === MUSL) {
-    name += '-musl';
+    name = `@parcel/watcher-${process.platform}-${process.arch}-musl`;
   } else {
-    name += '-glibc';
+    name = `@parcel/watcher-${process.platform}-${process.arch}-glibc`;
   }
 }

@theprivileges
Copy link

I ran into a very similar issue and got around it by:

  • adding @parcel/watcher-linux-x64-glibc into optionalDependencies in package.json
    • npm install -O @parcel/watcher-linux-x64-glibc
  • running npm dedupe
  • 💰

@paceaux
Copy link

paceaux commented Feb 6, 2024

ran into this same issue. @theprivileges solution worked for me. This was in a github action where I was having the issue.

winterjung added a commit to winterjung/blog that referenced this issue Feb 13, 2024
winterjung added a commit to winterjung/blog that referenced this issue Feb 13, 2024
* Fix image links

* Fix broken links

* Fix @parcel/wathcer

parcel-bundler/watcher#152
remarkablemark added a commit to remarkablemark/react-typescript-mui-rtk-query-parcel-template that referenced this issue Feb 26, 2024
```
Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-x64-glibc.
```

parcel-bundler/watcher#152
@OzzyCzech
Copy link

OzzyCzech commented Aug 23, 2024

I have exact same issue with building on node:alpine

Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-linux-x64-musl.
Please ensure it is installed (don't use --no-optional when installing with npm).
Otherwise it is possible we don't support your platform yet. If this is the case,
please report an issue to https://github.com/parcel-bundler/watcher

@abhimanyu7dev
Copy link

abhimanyu7dev commented Aug 27, 2024

I was able to solve this by adding npm install @parcel/watcher or whatever is suggested by error message after your npm install command.

RUN npm ci

RUN npm install @parcel/watcher

RUN npm run build

@imnasnainaec
Copy link

I had this problem with a GitHub action (reported here), and using npm dedupe resolved it.

amesgen added a commit to tweag/ghc-wasm-miso-examples that referenced this issue Oct 20, 2024
github-merge-queue bot pushed a commit to tweag/ghc-wasm-miso-examples that referenced this issue Oct 26, 2024
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

No branches or pull requests