krjo/shopify-webpack-dev-workflow

Error with npm start: UnhandledPromiseRejectionWarning: Error: No version of chokidar is available

Closed this issue · 3 comments

bkerz commented

Hello, i was following all your steps for integrating your workflow but when i executed npm start i saw this error:

> shopify-webpack-theme-development@1.0.0 start
> NODE_ENV=development webpack --watch

Executing pre-build scripts
Webpack build in progress...🛠

webpack is watching the files…

Executing post-build scripts
Build Complete 📦
(node:45743) UnhandledPromiseRejectionWarning: Error: No version of chokidar is available. Tried chokidar@2 and chokidar@3.
You could try to manually install any chokidar version.
chokidar@3: Error: Cannot find module 'chokidar'
chokidar@2: Error: Cannot find module 'watchpack-chokidar2'

    at Object.<anonymous> (/home/beicker/pampa/workflow-shopify/node_modules/watchpack/lib/chokidar.js:17:7)
    at Module._compile (/home/beicker/pampa/workflow-shopify/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/home/beicker/pampa/workflow-shopify/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/home/beicker/pampa/workflow-shopify/node_modules/watchpack/lib/DirectoryWatcher.js:9:16)
    at Module._compile (/home/beicker/pampa/workflow-shopify/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/home/beicker/pampa/workflow-shopify/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at WatcherManager.getDirectoryWatcher (/home/beicker/pampa/workflow-shopify/node_modules/watchpack/lib/watcherManager.js:14:25)
    at WatcherManager.watchFile (/home/beicker/pampa/workflow-shopify/node_modules/watchpack/lib/watcherManager.js:28:14)
    at Watchpack.<anonymous> (/home/beicker/pampa/workflow-shopify/node_modules/watchpack/lib/watchpack.js:38:49)
    at Array.map (<anonymous>)
    at Watchpack.watch (/home/beicker/pampa/workflow-shopify/node_modules/watchpack/lib/watchpack.js:37:28)
    at NodeWatchFileSystem.watch (/home/beicker/pampa/workflow-shopify/node_modules/webpack/lib/node/NodeWatchFileSystem.js:70:16)
    at Watching.watch (/home/beicker/pampa/workflow-shopify/node_modules/webpack/lib/Watching.js:114:48)
    at compiler.hooks.done.callAsync (/home/beicker/pampa/workflow-shopify/node_modules/webpack/lib/Watching.js:101:10)
    at _err0 (eval at create (/home/beicker/pampa/workflow-shopify/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at WebpackShellPlugin.<anonymous> (/home/beicker/pampa/workflow-shopify/node_modules/webpack-shell-plugin-next/lib/index.js:214:29)
    at step (/home/beicker/pampa/workflow-shopify/node_modules/webpack-shell-plugin-next/lib/index.js:57:23)
    at Object.next (/home/beicker/pampa/workflow-shopify/node_modules/webpack-shell-plugin-next/lib/index.js:38:53)
    at /home/beicker/pampa/workflow-shopify/node_modules/webpack-shell-plugin-next/lib/index.js:32:71
    at new Promise (<anonymous>)
    at __awaiter (/home/beicker/pampa/workflow-shopify/node_modules/webpack-shell-plugin-next/lib/index.js:28:12)
    at WebpackShellPlugin.onDone (/home/beicker/pampa/workflow-shopify/node_modules/webpack-shell-plugin-next/lib/index.js:185:65)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/beicker/pampa/workflow-shopify/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (/home/beicker/pampa/workflow-shopify/node_modules/tapable/lib/Hook.js:154:20)
    at Watching._done (/home/beicker/pampa/workflow-shopify/node_modules/webpack/lib/Watching.js:98:28)
    at compiler.emitRecords.err (/home/beicker/pampa/workflow-shopify/node_modules/webpack/lib/Watching.js:73:19)
(node:45743) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:45743) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

software info

Node version: v10.19.0
npm version: 7.7.4
OS: Ubuntu 20.04 LTS

If you need some additional information just let me know and i will tell you. Thanks

krjo commented

I'm not familiar with Ubuntu. I do see that my repo has chokidar version 3.5.1 installed, which webpack uses to watch files. Try installing node packages again and look for an error with the install of the chokidar package? Are you able to run the webpack watch command in a separate repo that uses webpack?

bkerz commented

@krjo Well... what i did was update node to v14.16.0, run npm cache clean -f, remove the package.json package-lock.json, node_modules and then install the dependencies you have one by one. That means that i have to use updated versions of all the packages so the configuration varies a bit, but it works like yours. Then i could solve the problem, but i'm still not sure what coused it.

krjo commented

Got it, I'll test out if there are issues with older node versions. Thanks