Closed sag8 closed 4 years ago
Have you tried running : "npm install" first ?
Have you tried running : "npm install" first ?
That was one quick reply. Thanks for the proactiveness and for building this tool.
Now, to answer the question - yes I did run npm install before running build command. After some googling, I found a way to save the missing packages displayed in the warning. Used the commands below:
npm install bufferutil -save
npm install iconv-lite -save
npm install utf-8-validate -save
But start is still giving me the same error.
(Also, I'm using Windows 10, if that makes any difference.)
Could you please pull the last version, I made some changes in the commands.
Sure, I'll pull the latest version.
Before I do that, I'll like to let you know about the different ways I tried to fix this -
tried running index.js file directly.
tried changing package.json file to have SET instead of ENV as I read that should be used for Windows. I used this command - set NODE_ENV=production && node ./dist/index.js
In both cases, I now get this error:
D:\GitHub\saplearninghub-pdf-downloader>npm run start
> saplearninghub-pdf-downloader@1.0.0 start D:\GitHub\saplearninghub-pdf-downloader
> set NODE_ENV=production && node ./dist/index.js
Error while reading config file: SyntaxError: Unexpected token C in JSON at position 220
at JSON.parse (<anonymous>)
at Module.<anonymous> (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:18:846278)
at t (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:110)
at D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:902
at Object.<anonymous> (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:913)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
Starting script...
(node:16624) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Error during puppeteer initialisation: Error: Could not find browser revision 737027. Run "npm install" or "yarn install" to download a browser binary.
at w.launch (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:1176908)
TypeError: Cannot read property 'browser' of undefined
at D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:18:854725
at s (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:1024883)
at Generator._invoke (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:1024636)
at Generator.forEach.e.<computed> [as next] (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:1025240)
at t (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:12899)
at c (D:\GitHub\saplearninghub-pdf-downloader\dist\index.js:1:13110)
I tried find a solution to this program but have failed to find a proper answer. I can see .local-chromium folder in Puppeteer's directory. I tried running Chrome.exe from there and it's working properly.
Will pull the latest version and report back.
Deleted the whole folder and pulled the whole project again. Now, I'm getting the Chromium error I mentioned above. "ENV is not a valid command" is resolved now. Thanks.
Could you please share de "config.json" file ? (Be sure to remove sensitive information first)
Here you go -
{
"DOWNLOAD_URL": "https://saplearninghub.plateau.com/icontent_e/CUSTOM_eu/sap/self-managed/ebook/BC401_EN_Col16_R1.3/index.html",
"LOGIN": "sagarsheokand@xxxx.com",
"PASSWORD": "abc123",
"TARGET_DIR": "D:\Clouds\Mega\LearningHub Downloads",
"DEBUG": false,
"CHROME_EXE": "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
"CHILD_STREAM": false
}
Ok, I haven't tried on Windows. You need to double the backslash on each path : \\
{
"DOWNLOAD_URL": "https://saplearninghub.plateau.com/icontent_e/CUSTOM_eu/sap/self-managed/ebook/BC401_EN_Col16_R1.3/index.html",
"LOGIN": "sagarsheokand@xxxx.com",
"PASSWORD": "abc123",
"TARGET_DIR": "D:\\Clouds\\Mega\\LearningHub Downloads",
"DEBUG": false,
"CHROME_EXE": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
"CHILD_STREAM": false
}
Ok, I haven't tried on Windows. You need to double the backslash on each path : \
{ "DOWNLOAD_URL": "https://saplearninghub.plateau.com/icontent_e/CUSTOM_eu/sap/self-managed/ebook/BC401_EN_Col16_R1.3/index.html", "LOGIN": "sagarsheokand@xxxx.com", "PASSWORD": "abc123", "TARGET_DIR": "D:\\Clouds\\Mega\\LearningHub Downloads", "DEBUG": false, "CHROME_EXE": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "CHILD_STREAM": false }
And it worked! Downloaded one book successfully. I'll try downloading some more books. Thanks, mate.
I might be doing something wrong, but I get warnings for several modules not found when I run the command "npm run build" and I think as a result "npm run start" fails saying - "'env' is not recognized as an internal or external command,". (Complete error at the end.)
Warnings after "npm run build":
Error after "npm run start":