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

Having trouble with Ajax and facebox integration issues?

My website utilizes ajax jquery and facebox for interactive features. You can check out a demo here. The div with the ID "#content" contains links to other pages that open successfully using facebox. However, when I reload the content of this div using aj ...

Member not found error with JQuery Autocomplete on browsers older than Internet Explorer 10

While constructing a web page with JQuery, I encountered issues with my autocomplete feature when testing it on IE8. The error message reads: SCRIPT3: Member not found. jquery-1.6.4.min.js, line 2 character 29472 After extensive research, I have been u ...

Navigate to a PDF file from an HTML5 application using PhoneGap by accessing an external link

Can anyone help me figure out what I'm doing wrong here? Essentially, I am trying to open a PDF in Google Viewer: <a id="pdflink" href="https://docs.google.com/viewer?url=http://pdpdpd.pdf" target="_blank">Pdf</a> When it opens in the vi ...

Load data into data tables through AJAX request

I'm currently working on implementing datatables and I'm facing an issue with populating my data table using an AJAX call. Here is the snippet of my AJAX call: $('#call_analysis_basic_table').DataTable ({ "ajax": { "url": " ...

The installation of Node Package Manager does not recognize the tilde (~) symbol in version numbers

Is there a way to install version 1.8.x of a package and automatically update it within the range of >=1.8.0 <1.9.0 later on? I attempted to use the following command: npm install example-package@~1.8 --save However, this command added the following ...

The initial setting of [opened]="true" causes an issue with the Angular Material date range picker

Recently, we completed the upgrade of our app from Angular 14 to 15.2.9, which includes Angular Material. The migration process went smoothly, and now our app is compiling and running without any errors. However, we encountered an issue with the mat-date-r ...

Observing mutations in HTML templates with MutationObserver

It appears that the MutationObserver does not function properly with a <template> tag. Check out this JSFiddle for more information! Any suggestions on how to effectively monitor changes in a <template> element? ...

Having trouble with the npm Twitter API functionality?

I'm attempting to execute a simple stream using an example code snippet. Here is the code I am working with: var twit = require('twitter'); var twitter = new twit({ consumer_key: '[KEY]', consumer_secret: &ap ...

Tips for saving JSON information into a variable using JavaScript

I am in need of a function called ** getJson () ** that can fetch and return data from a json file. Here is the JSON data (file.json): [ { "01/01/2021":"Confraternização Universal", "1 ...

verify whether the image source has been altered

There is an img tag displaying the user's avatar. When they click a button to edit the image and choose a new one, the src attribute of the img changes to the new image src. How can I detect when the src changes? Below is the code for the button tha ...

You are limited to storing only up to 2 items in the localStorage

My goal is to save items in local storage as an array of objects. Initially, it works perfectly and stores the first element in local storage as needed. However, I am facing an issue where I cannot store more than one element. Below is the code block that ...

What causes unescaped HTML characters to become unescaped when using $('div :not(script)').contents().filter(function()?

Developing a Chrome Extension that utilizes a click-to-call API, I have encountered an issue where certain pages are displaying unusual behavior. After investigating, I have identified this specific code snippet as the source of the problem. var rxpCtc = n ...

An error occurred while trying to load the resource in the Redux-Saga: connection refused

Utilizing axios allows me to make calls to the backend server, while redux-saga helps in managing side effects from the server seamlessly. import {call, put, takeEvery} from "redux-saga/effects"; import {REQUEST_FAILED, REQUEST_SUCCESS, ROOT_URL, SUBMIT_U ...

Troubleshooting Limitation Problem with Bootstrap Multiselect

I recently created a multiselect dropdown menu using Bootstrap Multiselect. I successfully set a limit on the number of options that can be selected (in this case, 5), and once the limit is reached, the additional options become disabled. Everything works ...

Backbone sorting is specifically designed for organizing views within the framework

As I work on creating a sorting function in backbone, I have come across recommendations to use views to listen for changes in collections and then render the views once the collections are sorted. However, this approach does not suit my needs for two main ...

Implementing global parameters in ui-router

Currently, I am utilizing ui-router in AngularJS as shown below: .state ('browse.category', { url: "/:category", templateUrl: "views/browseCategory.html", controller: function($stateParams, $scope) { $scope.params = $st ...

Failed to convert the value "hello" to an ObjectId (string type) for the _id path in the product model

i am currently using node, express, and mongoose with a local mongodb database. all of my routes are functioning correctly except for the last one /hello, which is giving me this error: { "stringValue": "\"hello\"&qu ...

Backdrop behind of Bootstrap modal located back of other page contents

I'm facing some challenges after transferring a website I developed locally to a live server. The modal windows are appearing behind other content on the live server, although they work perfectly fine on the local version. Despite my attempts to adju ...

Is it possible to retrieve a physical address using PHP or Javascript?

Is it possible to retrieve the physical address (Mac Address) using php or javascript? I need to be able to distinguish each system on my website as either being on the same network or different. Thank you ...

Utilize the $sample operator following the $group stage in MongoDB queries

Consider the dataset provided below: {company:"One", employee:"John"}, {company:"One", employee:"Mike"}, {company:"One", employee:"Donald"}, {company:"One", employee:"Mickey"}, {company:"Two", employee:"Johnny"}, {company:"Two", employee:"Da ...