parcel-bundler / watcher

šŸ‘€ A native C++ Node module for querying and subscribing to filesystem events
MIT License
656 stars 45 forks source link

@parcel/watcher not working with Docker node:alpine image #147

Closed azhar1038 closed 1 year ago

azhar1038 commented 1 year ago

I am trying to use watcher but getting this error:

 āœ” Network parcel-test_default     Created                                                                                                     0.8s 
 āœ” Container parcel-test-parcel-1  Created                                                                                                     1.9s 
Attaching to parcel-test-parcel-1
parcel-test-parcel-1  | 
parcel-test-parcel-1  | > parcel-test@1.0.0 start
parcel-test-parcel-1  | > node index.js
parcel-test-parcel-1  |
parcel-test-parcel-1  | /app/node_modules/@parcel/watcher/index.js:25
parcel-test-parcel-1  |       throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. 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.`);
parcel-test-parcel-1  |             ^
parcel-test-parcel-1  |
parcel-test-parcel-1  | 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.
parcel-test-parcel-1  |     at Object.<anonymous> (/app/node_modules/@parcel/watcher/index.js:25:13)
parcel-test-parcel-1  |     at Module._compile (node:internal/modules/cjs/loader:1233:14)
parcel-test-parcel-1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
parcel-test-parcel-1  |     at Module.load (node:internal/modules/cjs/loader:1091:32)
parcel-test-parcel-1  |     at Module._load (node:internal/modules/cjs/loader:938:12)
parcel-test-parcel-1  |     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:165:29)
parcel-test-parcel-1  |     at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
parcel-test-parcel-1  |     at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
parcel-test-parcel-1  |     at async loadESM (node:internal/process/esm_loader:40:7)
parcel-test-parcel-1  |     at async handleMainPromise (node:internal/modules/run_main:66:12)
parcel-test-parcel-1  |
parcel-test-parcel-1  | Node.js v20.4.0
parcel-test-parcel-1 exited with code 1

This is my Dockerfile

FROM node:alpine
WORKDIR /app
COPY ./package*.json /app
RUN npm install
COPY . .
CMD ["npm", "start"]

Dependencies:

  "dependencies": {
    "@parcel/watcher": "^2.2.0"
  }

Do I need to install something else too in my alpine image for watcher to work?

devongovett commented 1 year ago

Did you check if @parcel/watcher-linux-x64-musl was installed? If not, then make sure you didn't install with --no-optional

azhar1038 commented 1 year ago

Thanks for the reply. I am not sure how to install it. I see that musl folder is present inside node_modules. I didn't use any --no-optional flag in npm installas you can see in the Dockerfile. Can you please tell me how to install?

azhar1038 commented 1 year ago

I found the issue. My node_modules was mounted to the image. Closing this issue.