V
V
Vladimir2020-01-30 18:10:56
JavaScript
Vladimir, 2020-01-30 18:10:56

How to fix the error that occurs after installing osmosis (npm)?

Good evening. Please tell me how to fix this error, and it only occurs when integrating into a project, there are no errors when installing to an empty folder and running, and even if you disable all modules, there will be an error. Thank you.

Invalid property for defaults:compressed


[nodemon] starting `node app.js`
C:\Users\History\Desktop\session\node_modules\needle\lib\needle.js:776
throw new Error('Invalid property for defaults:' + target_key);
^

Error: Invalid property for defaults:compressed
at Function.module.exports.defaults (C:\Users\History\Desktop\session\node_modules\needle\lib\needle.js:776:13)
at Object. (C:\Users\History\Desktop\session\node_modules\libxmljs-dom\lib\HttpRequest.js:5:8)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object. Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules /cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (C:\Users\History\Desktop\session\node_modules\libxmljs-dom\lib\Window.js:8:22)
at Module._compile (internal/modules/cjs/loader.js:956:30)
[nodemon] app crashed - waiting for file changes before starting...


const { app,static } = require('../modules/app_config');
const osmosis = require('osmosis');

app.get('/scrap', (req, res) => {
    res.sendFile(`${static}/www/scrap.html`)
});

app.post('/scrap', (req,res) => {
    let savedData = [];

    osmosis
        .get(`https://synapsenet.ru/searchorganization/proverka-kontragentov?query=${encodeURI(req.body.data)}`)
        .paginate('.organization-block')
        .find('.organization-name')
        .set('org-name')
        .find('.organization-status')
        .set('status')
        .log(console.log) // включить логи
        .error(console.error) // на случай нахождения ошибки
        .data((data) => {
            console.log();
            savedData.push(data);
        })
        .done(function() {
            fs.writeFile('data.json', JSON.stringify( savedData, null, 4), function(err) {
                if(err) console.error(err);
                else console.log('Data Saved to data.json file');
            })
        });
});


I installed npm i osmosis like this, tried to reinstall libxmljs-dom itself, the result is identical.

package.json

{
  "name": "session",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "dependencies": {
    "bcrypt": "^3.0.6",
    "body-parser": "^1.19.0",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-session": "^1.17.0",
    "libxmljs-dom": "0.0.17",
    "multer": "^1.4.2",
    "mysql": "^2.17.1",
    "nodemon": "^1.19.4",
    "osmosis": "^1.1.10",
    "passport": "^0.4.0",
    "passport-local": "^1.0.0",
    "session-file-store": "^1.3.1",
    "util": "^0.12.1",
    "wget-improved": "^3.0.2"
  },
  "devDependencies": {},
  "scripts": {
    "start": "nodemon --ignore /sessions/ app.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shohruh Shaimardonov, 2020-01-30
@HistoryART

There is a question about this in the Gita in Ishyu . Judging by the discussion, a bug in osmosis

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question