Webpack error/warnings due to installing cloudscraper library

Previously, I solved one problem by change the version of fs library from “0.0.1-security” to 0.0.2.

However, I encountered new problems. I’m now able to see other pages that don’t use do require(“cloudscraper”), however the page that calls require(“cloudscraper”) function shows blank with the following warning in glitch log:

WARNING Compiled with 1 warnings02:04:09
warning in /rbd/pnpm-volume/eec62301-d63b-4d95-a543-0348444d1ed5/node_modules/.registry.npmjs.org/cloudscraper/4.1.2/node_modules/cloudscraper/lib/brotli.js

17:11-18 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Any help would be appreciated :slight_smile:

Error on browser’s console on this page that uses cloudscraper:

client.js:522 [nuxt] Error while initializing app Error: Cannot find module "."
at webpackMissingModule (brotli.js:17)
at Object.<anonymous> (brotli.js:17)
at Object.../rbd/pnpm-volume/eec62301-d63b-4d95-a543-0348444d1ed5/node_modules/.registry.npmjs.org/cloudscraper/4.1.2/node_modules/cloudscraper/lib/brotli.js (brotli.js:36)
at __webpack_require__ (bootstrap 92d12d5172aae9f61e7a:712)
at fn (bootstrap 92d12d5172aae9f61e7a:117)
at Object.../rbd/pnpm-volume/eec62301-d63b-4d95-a543-0348444d1ed5/node_modules/.registry.npmjs.org/cloudscraper/4.1.2/node_modules/cloudscraper/lib/headers.js (headers.js:4)
at __webpack_require__ (bootstrap 92d12d5172aae9f61e7a:712)
at fn (bootstrap 92d12d5172aae9f61e7a:117)
at Object.<anonymous> (index.js:6)
at Object.../rbd/pnpm-volume/eec62301-d63b-4d95-a543-0348444d1ed5/node_modules/.registry.npmjs.org/cloudscraper/4.1.2/node_modules/cloudscraper/index.js (index.js:504)
at __webpack_require__ (bootstrap 92d12d5172aae9f61e7a:712)
at fn (bootstrap 92d12d5172aae9f61e7a:117)
at Object.../rbd/pnpm-volume/eec62301-d63b-4d95-a543-0348444d1ed5/node_modules/.registry.npmjs.org/babel-loader/7.1.5/babel-core@6.26.3+webpack@3.12.0/node_modules/babel-loader/lib/index.js?{"babelrc":false,"cacheDirectory":true,"plugins":[["transform-imports",{"vuetify":{"transform":"vuetify/es5/components/${member}","preventFullImport":true}}]],"presets":[["/rbd/pnpm-volume/eec62301-d63b-4d95-a543-0348444d1ed5/node_modules/.registry.npmjs.org/babel-preset-vue-app/2.0.0/node_modules/babel-preset-vue-app/dist/index.common.js",{"targets":{"ie":9,"uglify":true}}]]}!../rbd/pnpm-volume/eec62301-d63b-4d95-a543-0348444d1ed5/node_modules/.registry.npmjs.org/vue-loader/13.7.3/d029cddaac9a10ba78648298334c6478/node_modules/vue-loader/lib/selector.js?type=script&index=0!./pages/trial/_username.vue (_username.vue?e84e:9)
at __webpack_require__ (bootstrap 92d12d5172aae9f61e7a:712)
at fn (bootstrap 92d12d5172aae9f61e7a:117)
at Object../pages/trial/_username.vue (_username.vue:1)
at __webpack_require__ (bootstrap 92d12d5172aae9f61e7a:712)
at fn (bootstrap 92d12d5172aae9f61e7a:117)

(anonymous) @ client.js:522
Promise.catch (async)
./.nuxt/client.js @ client.js:518
__webpack_require__ @ bootstrap 92d12d5172aae9f61e7a:712
fn @ bootstrap 92d12d5172aae9f61e7a:117
0 @ app.styl?0495:21
__webpack_require__ @ bootstrap 92d12d5172aae9f61e7a:712
webpackJsonpCallback @ bootstrap 92d12d5172aae9f61e7a:25
(anonymous) @ app.js:1
client.js?name=client&reload=true&timeout=30000&path=/__webpack_hmr:195 [HMR] bundle 'client' has 1 warnings

Hi @Nameless9, I’m not seeing those errors in your project right now, and it seems like you’ve made some significant changes to the project since you asked this question. Have you resolved your issue?

hi cory, no I have not resolved it.

I just commented out the line that calls require ("cloudscraper") in my pages/trial/_user.vue page to kind of ignore the problem for now. Your attention is much appreciated to my issue

Besides that, I do find myself needing to either learn CORS or a way to serverside render my website - I do need to get info from other website. I’m currently in the process of trying to find serverside rendering with nuxt.js. For now, it seems, I’ll have to go with express.js + Vue server renderer ( https://ssr.vuejs.org) Nuxt.js says they have smoothened the server rendering experience but I haven’t seen any examples

Hey @Nameless9, one thing we’ve recently discovered is that Nuxt.JS isn’t compatible with pnpm, our default package manager. If you want to use Nuxt for now you’ll need to switch to npm by running enable-npm in your project’s console. Keep in mind, though, that using npm will mean that your packages will take up space in your project’s disk instead of in the shared space, so that may cause problems for you.

Let us know how you get on!

1 Like

thanks for letting me know that. Anyways I decided to make a simple server-side website using express.js. I learnt from experience that cloudscraper only works for servers, which is logical.