Puppeteer experiencing issues with missing relative modules and dependencies not being found

After installing puppeteer via npm, I encountered errors when trying to compile it:

This dependency was not found:

* ws in ./node_modules/puppeteer/lib/WebSocketTransport.js

To resolve this, you can run: npm install --save ws


These relative modules were not found:

* ./types/other in ./node_modules/puppeteer/node_modules/mime/index.js
* ./types/standard in ./node_modules/puppeteer/node_modules/mime/index.js 

Regarding ws: I attempted to reinstall ws using npm install --save ws, but the issue persisted.

As for ./types/other and .types/standard, I tried modifying the file

node_modules/puppeteer/node_modules/mime/index.js
by adding .json at the end of the filename in require. Admittedly, altering files in the vendor folder is not the correct approach, but I'm unsure how to rectify this properly.

I explored solutions provided here: https://github.com/GoogleChrome/puppeteer/issues/2754#issuecomment-403321142

Despite my efforts, the issue persists, leading me to question if I have grasped the solution correctly.

Here is a snippet from my package.json:

{
  "jest": {
    "moduleFileExtensions": [
      "json",
      "vue",
      "js"
    ]
  },
  "private": true,
  "scripts": {
     ...
  },
  "devDependencies": {
    "axios": "^0.17",
    "bootstrap": "^4.1.3",
    "cross-env": "^5.2.0",
    "jquery": "^3.2",
    "laravel-mix": "^2.1.14",
    "lodash": "^4.17.11",
    "popper.js": "^1.14.4",
    "postcss-css-variables": "^0.9.0",
    "vue": "^2.5.17"
  },
  "dependencies": {
    "ajv": "^6.0.0",
    "imagemin": "^5.0.0",
    "npm": "^5.10.0",
    "puppeteer": "^1.14.0",
    "ws": "^6.2.1"
  }
}

The inclusion of jest in my dependencies seems odd as I do not have jest installed. I am now uncertain about how to address this issue.

Answer №1

While facing a similar issue with using puppeteer, I discovered that there were some dependencies causing trouble within puppeteer itself. Unable to find a direct solution, I came across an alternative method of still utilizing puppeteer through another module. To get started, follow these steps in your command line:

npm install --save apify

Next, install the Apify CLI as well:

npm install -g apify-cli

After that, proceed with creating a new project by running:

apify create my-hello-world

Be sure to select the option that integrates puppeteer, which will provide you with a pre-made example to kickstart your usage of puppeteer just like before. Additionally, the Apify module offers extra features such as local storage and cloud deployment, although these are optional enhancements rather than prerequisites.

For further details, visit this link for the basic apify module along with sample codes and commands.

An official website is also available for those looking to explore more advanced web-scraping capabilities using Apify. Check out this guide to get started with Apify.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What causes the NbAdjustableConnectedPositionStrategy error and how can it be remedied efficiently?

Using the nebular theme for UI, I have encountered an error in my template that was not present in my previous project. In this current Nx (monorepo) project, when I click on a name, the popover pane is displaying at the wrong position. This issue can be s ...

Is it possible to extract the body from the post request using req.body.item?

After working with Express, I learned how to extract body data from a post request. Most examples showed that using req.body.item should retrieve the desired value for tasks like inserting into a table. However, in my case, I found that I couldn't ac ...

Guide to retrieving a specific cookie value with socket.io

I have successfully retrieved all cookies using the socket.request.headers.cookie. Upon console logging, the output appears as follows: PHPSESSID=mtklg8k81cpkop5ug6aechbb34; user=77; io=1Klg6xgTRXhb2OWiAAAA Now, I am trying to extract only the value of ...

Instructions on how to eliminate the minutes button from Material UI datetime picker

I'm currently working on customizing a datetimepicker from materialUI in ReactJS. My goal is to prevent the user from seeing or selecting minutes in the picker interface. Despite setting the views prop to include only year, month, date, and hours, use ...

When working with `yo angular`, I encountered an error message stating "npm ERR! code ENOENT npm ERR! errno 34" despite having cleaned the cache and set up a .npmignore

After attempting to execute yo angular in a fresh project directory, I encountered the ENOENT error during the process. Despite referring to a similar question on Stack Overflow, the suggested solution did not resolve my issue. Prior to running yo angular ...

The issue of using an import statement outside a module arises when executing Protractor

I am facing an issue while running Protractor with my two files. When I execute the command "protractor protractor.config.js", I encounter the following error: D:\work\staru-app>protractor protractor.config.js [16:57:17] I/launcher - Running ...

Prevent IonContent from scrolling to the bottom or top when using Ionic framework

In my Ionic app, I have a long text page with 2 buttons that trigger the actions scrollToBottom and scrollToTop. Due to the length of the page, I have set the scroll duration to be 30 seconds. I am facing two issues here: How can I stop the scrolling ...

Is it possible to use an ngClick function in one directive to toggle data in another?

Currently, I am in the process of developing a weather application using Angular 1.5.8 where users should have the option to switch between imperial and metric units for temperature and wind speed. The toggle feature along with all the weather data fetche ...

Unable to access setRowData() in AgGrid/Angular 2 leads to rendering of the grid without displaying any rowData

Resolved I think my solution is temporarily fixed and it reveals that I may have set up my mongoose model incorrectly. The answer provided did assist me in solving my issue, but ultimately the reason for the empty data rows was due to incorrect identifier ...

Is it necessary to release a new library version for non-functional updates?

As the maintainer of several JavaScript libraries, I often find myself needing to update dependencies that don't necessarily require any functional changes. This is especially true when my library is not impacted by a breaking change in one of its dep ...

Refreshing the package using Bower

I'm facing an issue while trying to upgrade angular from version 1.0.5 to 1.0.6 using Yeoman. Despite clearing the cache and checking the Github repository, it still installs version 1.0.5. Is there a workaround to force the update to version 1.0.6? ...

Is there a way to iterate through indexed variables in javascript?

After receiving an array of data from a JQuery .ajax function, I noticed that the fields in the array are named and numbered like part1, part2, part3, etc. I attempted to loop through this data using the code below, but unfortunately, it resulted in NaN: ...

Retrieving a subset of JSON data from a larger JSON object in a Node.js environment

I'm working with a JSON object structured like this: [ { "id": "458712e247328e4ebfafeb4d922b", "value": [ 1 ], "location": null, "metadata": null, "at": "2015-07-16T16:33:39.113Z" }, { "id": "1ghj78d8220734c00ab941 ...

Alter the arrow to dynamically point towards the location of the click source

I am currently working on creating a popover dialog that should point to the element triggering its appearance. The goal is for the arrow to align with the middle of the button when clicked. While I am familiar with using CSS to create pointing arrows, th ...

Sparse planeBufferGeometry in THREE.js is a specialized type of geometry that

I am currently working with a file that contains sparse elevation data derived from GPS information. I have been utilizing this data to fill a PlaneBuffer array with elevations. var vertices = new Float32Array( (grid.NCOL*grid.NROW) * 4 ); for (var i = 0, ...

Looking for a unique search object specifically designed for mongodb?

I am currently developing my first application using node.js and angular, and I have encountered a challenge that I am struggling to solve. Let's say I have a User Schema like this: User = { firstname: "Bryan", lastname: "Allan", email: "<a ...

The ultimate guide to personalizing group titles in Angular UI-Select

Is there a way in Angular ui-select to customize the group label? I want to make it larger than the selection items as shown in the image below. https://i.stack.imgur.com/ofcak.png The list is currently grouped by country, but how can I adjust the size o ...

Vue framework fails to recognize the spread operator when used with WebPack

The code snippet below was recommended in this particular answer. import { mapActions } from 'vuex' export default { vuex: { getters: { activeDataRow: state => state.activeDataRow }, actions: { updateData, resetData } }, methods: ...

Tracking by $index yields an overwhelming amount of results

Encountered an error with Angular that mentioned duplicates in a repeater: To address this, I added the following line of code: rooster in rooster.uren track by $index However, this caused an unexpected issue where multiple panels were created even thoug ...

Issue with NPM, Zurb Foundation, and WebPack: Unable to locate module 'foundation'

I'm currently in the process of integrating Zurb Foundation with WebPack and NPM, but without using Bower. The issue I'm facing is similar to the following link: https://github.com/zurb/foundation-sites/issues/7386 Basically, after installing ...