Webpack - Can't resolve jquery - webpack-2

I'm new to webpack and I'm actually stucked. I read some articles about webpack and so started trying it on a project (just on third part libraries). I have created my entry-point.js:
require('angular');
require('angular-bootstrap');
require('angular-file-upload');
require('angular-local-storage');
require('angular-ui-grid');
require('angular-ui-router');
require('ng-idle');
require('bootstrap');
require('jquery');
and the webpack.config.js:
module.exports = {
entry : './entry-point.js',
output : {
path : __dirname + "/dist",
filename : 'vendor.js'
},
resolve : {
modules : [ 'bower_components' ]
}
};
but when I launch the 'npm start' I get the following error:
Module not found: Error: Can't resolve 'jquery' in
'D:\Documents\Sviluppo\Eclipse\Workspace\SCARICO-TeamcenterEasyApp\target\TeamcenterEasyApp-0.0.1'
resolve 'jquery' in
'D:\Documents\Sviluppo\Eclipse\Workspace\SCARICO-TeamcenterEasyApp\target\TeamcenterEasyApp-0.0.1'
Obviously the library is present in my bower_components folder.
Note: webpack version 2.2.1
And this is my package.json:
{
"name": "TeamcenterEasyApp-0.0.1",
"version": "1.0.0",
"description": "",
"main": "entry-point.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"webpack": "^3.8.1"
}
}

Related

How to build window electron executable program with babel

Actually I can build to use electron --trace-warnings -r #babel/register . and with #babel
electron-builder --windows nsis:ia32 command is success as a result
but i execute that, it occur error.
A JavaScript eror occured in the main process
C:\dev\electron\SomeDirectoryPath123123\index.js:1
import {app, BrowserWindow} from "electron";
^^^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFuntion (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1039:15)
...etc...
please help me..
.babelrc
{
"presets": ["#babel/preset-env"]
}
package.json
{
"name": "test app",
"version": "1.0.0",
"description": "helpp me",
"main": "index.js",
"scripts": {
"manual-run": "electron --trace-warnings -r #babel/register .",
"build-package": "electron-builder --windows nsis:ia32"
},
"author": "nother",
"license": "ISC",
"devDependencies": {
"#babel/cli": "^7.17.10",
"#babel/core": "^7.18.5",
"#babel/node": "^7.18.5",
"#babel/preset-env": "^7.18.2",
"#babel/register": "^7.17.7",
"electron": "^19.0.4",
"electron-builder": "^23.0.3"
},
"dependencies": {
"#babel/cli": "^7.17.10",
"#babel/core": "^7.18.5",
"#babel/node": "^7.18.5",
"#babel/preset-env": "^7.18.2",
"#babel/register": "^7.17.7",
"elasticsearch": "^16.7.3",
"express": "^4.18.1",
"mongodb": "^4.7.0",
"node-fetch": "^2.6.7",
"sqlite3": "^5.0.8"
},
"build": {
"appId": "test-electron-app",
"productName": "hello!",
"buildDependenciesFromSource": false,
"asar": true,
"files": [
"dist/**/*",
"package.json",
"index.js"
],
"win": {
"target": "nsis"
},
"nsis": {
"oneClick": false
},
"directories": {
"buildResources": "./build/",
"output": "./distout/"
}
}
}

Whatsapp web js not working with electronjs

I make a project in electronJS with whatsapp-web.js. When i debug with npm start it works properly.
but when I build with electron and install the (.exe) file the project don't works. It seems the Puppeteer not running. How can I solve the problem?
NB: I am using electron-builder for build the application for Windows.
{
"name": "testapp",
"version": "1.0.0",
"description": "testapp",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder"
},
"build": {
"appId": "com.testapp.test",
"productName": "testapp",
"target": "NSIS",
"nsis" : {
"oneClick" : true,
"allowToChangeInstallationDirectory" : false
}
},
"author": "Udayan Basak",
"license": "ISC",
"devDependencies": {
"electron": "^15.3.1",
"electron-builder": "^22.14.5"
},
"dependencies": {
"whatsapp-web.js": "^1.15.2"
}
}
This is my package.json data.
[Again: full project working fine in development mode. It causes error in production lavel.]
const { Client } = require('whatsapp-web.js');
const {app, BrowserWindow, ipcMain, ipcRenderer } = require('electron')
const client = new Client();
client.on('qr', (qr) => {
win.webContents.send("qrcode", qr)
});
client.on('ready', () => {
win.webContents.send("ready", "ready")
})

error showing while creating a debian file from electronjs project

I am getting the below error while making deb file of electronjs
Error: could not find the Electron app binary at "dist/app-linux-x64/koriwallet". You may need to re-bundle the app using Electron Packager's "executableName" option.
My package.json file is
{
"name": "wallet",
"version": "1.0.0",
"description": "wallet",
"main": "src/main.js",
"scripts": {
"start": "electron .",
"build": "electron-packager . myapp",
"pack": "electron-builder --dir",
"dist": "electron-builder",
"deb64": "electron-installer-debian --src dist/app-linux-x64/ --dest dist/installers/ --arch amd64"
},
"author": "wallet",
"license": "ISC",
"devDependencies": {
"asar": "^2.0.1",
"electron": "^5.0.6",
"electron-builder": "^21.1.1",
"electron-installer-debian": "^2.0.0",
"electron-packager": "^14.0.2"
},
"electronPackagerConfig": {
"packageManager": "npm",
"executableName": "kori"
},
"build": {
"appId": "wallet",
"linux": {
"category": "wallet"
}
},
"dependencies": {
"cookies": "^0.7.3",
"crypto": "^1.0.1",
"dpkg": "^1.0.0",
"jquery": "^3.4.1",
"jstorage": "^0.4.8"
}
}
My 2 cents. I'm making an Fedora 30 rpm and got:
An unhandled error has occurred inside Forge:
An error occured while making for target: rpm
could not find the Electron app binary at "/home/ajm/Documents/Projects/sunstealer.ets/out/sunstealer.ets product-linux-x64/sunstealer.ets". You may need to re-bundle the app using Electron Packager's "executableName" option.
Error: could not find the Electron app binary at "/home/ajm/Documents/Projects/sunstealer.ets/out/sunstealer.ets product-linux-x64/sunstealer.ets". You may need to re-bundle the app using Electron Packager's "executableName" option.
at error.wrapError (/home/ajm/Documents/Projects/sunstealer.ets/node_modules/electron-installer-common/src/installer.js:145:15)
Fix was update package.json from
"name": "sunstealer.ets",
"productName": "sunstealer.ets product",
to:
"name": "sunstealer.ets",
"productName": "sunstealer.ets",
i.e. same value. Then npm run make with:
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "#electron-forge/maker-squirrel",
"config": {
"certificateFile": "./certs/adam_mauger.pfx",
"certificatePassword": "REDACTED"
}
},
{
"name": "#electron-forge/maker-dmg",
"config": {
"format": "ULFO"
}
},
{
"name": "#electron-forge/maker-rpm",
"config": {
}
},
created sunstealer.ets-1.0.0-1.x86_64.rpm. Hope that helps.
my 5 cents)
so, launch npm from root folder. there exist node_modules.
app stored in root/src. there exist node_modules.
and in root and in root/src have package.json
check root/src/package.json file. maybe there parameter "name" have default value in lowercase

Zapier validate method returns error

. This is the error I get when I run "zapier validate" command. My package.json file has this code :
"name": "github-example-app",
"version": "1.0.0",
"description": "An example app for the Zapier platform.",
"repository": "zapier/zapier-platform-app-github-example",
"homepage": "https://zapier.com/developer",
"author": "Zane Lyon <zane.lyon#zapier.com>",
"license": "BSD-3-Clause",
"main": "index.js",
"scripts": {
"test": "node node_modules/mocha/bin/mocha --recursive"
},
"engines": {
"node": "8.10.0",
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "^7.0.0"
},
"devDependencies": {
"mocha": "^5.2.0",
"should": "^13.2.0"
}
and here is the package-lock.json code which shows the zapier-platform-core details:
"zapier-platform-core": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/zapier-platform-core/-/zapier-platform-core-7.0.0.tgz",
"integrity": "sha512-8nJ9xs6Dig1/Hvvpcz3upD0lnPd/gg5YCpum2S5xLnsV5yuQXUcEIXuQq7T5PPksmQgO3ux57szN4EU2+q9RvA==",
"requires": {
"bluebird": "3.5.0",
"content-disposition": "0.5.2",
"dotenv": "5.0.1",
"form-data": "2.2.0",
"lodash": "4.17.10",
"node-fetch": "1.7.1",
"zapier-platform-schema": "7.0.0"
}
},
I tried changing the package.json code as
"dependencies": {
"zapier-platform-core": "^7.0.0"
},
to
"dependencies": {
"zapier-platform-core": "7.0.0"
},
after this I get the error
What must I do to resolve this ? This code was running fine two days back. What might have happened to cause this error?
David here, from the Zapier Platform team.
That error comes from here and pops up when we can't find zapier-platform-core in node_modules.
It seems like it should be there given what you posted. with "zapier-platform-core": "7.0.0" in your package.json, run rm -rf node_modules && npm i to make sure everything is fresh.
If that doesn't work, please open an issue at https://github.com/zapier/zapier-platform-cli/issues/new.

I can't find the javascript in main bracket in bower

I already added the dependency of blueimp-file-upload in my bower file. ( bower.json)
{
"name": "redca-admin-web",
"version": "0.0.1",
"description": "RedCA Admin frontend implementation",
"authors": [
"redca <redca#samsung.com>"
],
"main": "index.html",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": ">=1.6",
"jquery-ui": ">=1.6",
"rdash-ui": "1.0.*",
"angular": "~1.2.21",
"angular-cookies": "~1.2.28",
"angular-bootstrap": "~0.11.0",
"angular-ui-router": "^0.2.10",
"bootstrap": "~3.2.0",
"font-awesome": "~4.1.0",
"angular-route": "~1.2.28",
"angular-resource": "~1.2.28",
"font-awesome": "~4.1.0",
"blueimp-file-upload" : "9.9.3"
},
"repository": {
"type": "git",
"url": "https://github.com/rdash/rdash-angular"
}
}
and I installed the dependency with the command, "bower install" and I can confirmed the dependencies in the folder, "src/components". But I can't find the
classes in main bracket in the followings. I saw the explanation of bower main page that the java script files in the main bracket are heavily used files.
main string or array: The primary acting files necessary to use your
package.
I am confused whether or not I misunderstood. Should I download the library that contains java-script files in main bracket separately?
{
"name": "blueimp-file-upload",
"version": "9.9.3",
"title": "jQuery File Upload",
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
"keywords": [
"jquery",
"file",
"upload",
"widget",
"multiple",
"selection",
"drag",
"drop",
"progress",
"preview",
"cross-domain",
"cross-site",
"chunk",
"resume",
"gae",
"go",
"python",
"php",
"bootstrap"
],
"homepage": "https://github.com/blueimp/jQuery-File-Upload",
"author": {
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
},
"maintainers": [
{
"name": "Sebastian Tschan",
"url": "https://blueimp.net"
}
],
"repository": {
"type": "git",
"url": "git://github.com/blueimp/jQuery-File-Upload.git"
},
"bugs": "https://github.com/blueimp/jQuery-File-Upload/issues",
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/MIT"
}
],
"dependencies": {
"jquery": ">=1.6",
"blueimp-tmpl": ">=2.5.4",
"blueimp-load-image": ">=1.13.0",
"blueimp-canvas-to-blob": ">=2.1.1"
},
"main": [
"css/jquery.fileupload.css",
"css/jquery.fileupload-ui.css",
"css/jquery.fileupload-noscript.css",
"css/jquery.fileupload-ui-noscript.css",
"js/cors/jquery.postmessage-transport.js",
"js/cors/jquery.xdr-transport.js",
"js/vendor/jquery.ui.widget.js",
"js/jquery.fileupload.js",
"js/jquery.fileupload-process.js",
"js/jquery.fileupload-validate.js",
"js/jquery.fileupload-image.js",
"js/jquery.fileupload-audio.js",
"js/jquery.fileupload-video.js",
"js/jquery.fileupload-ui.js",
"js/jquery.fileupload-jquery-ui.js",
"js/jquery.fileupload-angular.js",
"js/jquery.iframe-transport.js"
],
"ignore": [
"/*.*",
"/cors",
"css/demo-ie8.css",
"css/demo.css",
"css/style.css",
"js/app.js",
"js/main.js",
"server",
"test"
],
"_release": "9.9.3",
"_resolution": {
"type": "version",
"tag": "9.9.3",
"commit": "d4b0492c6e0ba77b446a3bfb2847a0a4827a9c08"
},
"_source": "https://github.com/blueimp/jQuery-File-Upload.git",
"_target": "9.9.3"
}

Resources