How can I get lib ldap-client in node.js? - javascript

I can't get lib ldap-client in Node.js.
I used this page https://github.com/nodejs/node-gyp to help solve the problem.
I installed python, node-gyp, Visual Studio 2015.
All of the packages for LDAP connection have this problem.
I'm working in Windows 7.
Here's my package.json:
{
"name": "taakapis",
"version": "0.0.0",
"private": true,
"main": "app.js",
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "latest",
"cookie-parser": "latest",
"debug": "latest",
"express": "latest",
"jade": "latest",
"morgan": "latest",
"serve-favicon": "latest",
"nodemon":"latest",
"mysql":"latest",
"date-and-time":"latest",
"trim":"latest",
"dateformat":"latest",
"is-my-json-valid":"latest",
"md5":"latest",
"ldap-client":"latest"
}
}
Attempting to resolve package ldap-client I get this:

This error can occur if your gcc version configuration is not right. So try
exporting the path.
export PATH=/opt/rh/devtoolset-2/root/usr/bin:$PATH

Related

Why babel-node "Cannot find module" without ".js" extension?

I dont know why babel-node does not import without ".js" extension.
I have "type": "module" in package.js
import example from "./src/example.js"; works fine
import example from "./src/example"; doesnt work
--es-module-specifier-resolution=node works only when I dont use babel-node
package.js
"type": "module",
"scripts": {
"start": "node ./index.js --exec babel-node -e js --experimental-modules --es-module-specifier-resolution=node "
},
"dependencies": {
"bcrypt": "^5.0.1",
"body-parser": "^1.20.0",
"express": "^4.18.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.3.5",
"nodemon": "^2.0.16",
"npm": "^8.12.1"
},
"devDependencies": {
"#babel/cli": "^7.17.10",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-0": "^6.24.1"
}
npm install #babel/node solved my problem

Electron Js - A javascript error occurred in the main process

I have created an electron project which is working fine but when I try to package an electron app using electron packager and then run it. I am facing an exception
Uncaught Exception:
Error: Cannot find module
Require stack
'E:\app-folder..release-builds\app-win32-ia32\resources\app....\node_sqlite3.node'
click here to see Error
'Here is my package.json'
{
"name": "app",
"version": "1.0.0",
"main": "main.js",
"devDependencies": {
"electron": "^8.2.0",
"electron-builder": "^22.8.0",
"electron-rebuild": "^1.10.1"
},
"scripts": {
"start": "electron .",
"rebuild": "electron-rebuild -f -w sqlite3",
"package-win": "electron-packager . App--overwrite --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"App\"",
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {
"axios": "^0.19.2",
"concat-stream": "^2.0.0",
"datatables.net": "^1.10.20",
"datatables.net-dt": "^1.10.20",
"ejs": "^3.1.5",
"electron-packager": "^15.0.0",
"express-validator": "^6.6.1",
"form-data": "^3.0.0",
"jquery": "^3.5.0",
"nodemailer": "^6.4.11",
"sqlite3": "^5.0.0"
}
}
npm install --save-dev #electron-forge/cli
npm run package
try running these commands you will get an out folder and the application is present in that out folder

"Cannot GET /" error when deploying Nuxt Vue.js application to Google App Engine

I get a "500 Server Error" when I deploy my Nuxt application.
Below are my configuration files:
package.json
{
"name": "my-app-name",
"version": "1.0.0",
"description": "An App",
"author": "Me",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "NODE_ENV=production nuxt",
"deploy": "npm run build && gcloud app deploy",
"generate": "nuxt generate",
"postinstall": "nuxt build"
},
"dependencies": {
"#nuxtjs/axios": "^5.0.0",
"#firebase/firestore": "^0.6.0",
"#firebase/storage": "^0.2.3",
"firebase": "^5.3.0",
"nuxt": "^1.0.0",
"nuxt-buefy": "^0.0.4"
},
"devDependencies": {
"cross-env": "^5.0.1",
"node-sass": "^4.9.2",
"nuxt-sass-resources-loader": "^2.0.3",
"sass-loader": "^7.0.3"
}
}
Previously my start was nuxt start and i do not have deploy
https://github.com/kamatte-me/nuxt-gae-se/blob/master/package.json
But still get the same error.
app.yaml
runtime: nodejs8
env : standard
I also referred and attempted to try out the suggestions here and here but doesn't work. Note that my application does not have a server.js or app.js, so i cannot use those.
Update
I did a workaround using the below approach (so can ignore everything above unless you need it as additional reference).
I added a server.js (exactly same as theirs) following https://github.com/kamatte-me/nuxt-gae-se and updated my package.json to such:
{
"name": "my-app-name",
"version": "1.0.0",
"description": "A App",
"author": "Me",
"private": true,
"scripts": {
"dev": "node server.js",
"build": "nuxt build",
"start": "NODE_ENV=production node server.js",
"deploy": "npm run build && gcloud app deploy",
"generate": "nuxt generate",
"postinstall": "nuxt build"
},
"dependencies": {
"#nuxtjs/axios": "^5.0.0",
"#firebase/firestore": "^0.6.0",
"#firebase/storage": "^0.2.3",
"express": "^4.16.3", //<-added this as suggested by kamette
"firebase": "^5.3.0",
"nuxt": "^1.0.0",
"nuxt-buefy": "^0.0.4"
},
"devDependencies": {
"cross-env": "^5.0.1",
"node-sass": "^4.9.2",
"nuxt-sass-resources-loader": "^2.0.3",
"sass-loader": "^7.0.3"
}
}
Now my error is this:
Any idea?
I have this in my Navigation.vue:
<nuxt-link to="/" exact>Dashboard</nuxt-link>
In addition, the error logs I saw:
After adding "nuxt-sass-resources-loader": "^2.0.3" to the dependencies as advised by kamatte, I am seeing back the "500 Server Error" again, logs doesn't show anything useful (I have clicked "Load newer logs" many times already, this is the latest...)
Express.js and nuxt-sass-resources-loader must be included in package.json.
.e.g.)
package.json
"dependencies": {
"express": "^4.16.3",
"nuxt-sass-resources-loader": "^2.0.3"
},
Otherwise, Express.js will not be installed on the GAE.
It seems that it worked because you already installed Express.js in your local environment.

nodeJS - nodemon console log stopped working

I am having a weird problem, suddenly the nodemon stopped showing console log.
I am using npm run dev command to run the nodeJS app and my package.json looks like below,
{
"name": "loginform",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon app.js"
},
"dependencies": {
"async": "^2.1.4",
"body-parser": "^1.15.2",
"body-parser-xml": "^1.1.0",
"cassandra-driver": "^3.1.6",
"connect-flash": "^0.1.1",
"ejs": "^2.0.6",
"es6-template-strings": "^2.0.1",
"express": "^4.14.0",
"express-rate-limit": "^2.6.0",
"express-session": "^1.10.1",
"log-buffer": "0.0.3",
"mongodb": "^2.2.25",
"mongoose": "^4.7.0",
"nodemailer": "^0.7.1",
"passport": "^0.2.1",
"passport-facebook": "^1.0.3",
"passport-local": "^1.0.0",
"passport-twitter": "^1.0.2",
"qs": "^6.3.0",
"sweetalert2": "^6.5.5",
"trim": "0.0.1",
"url-pattern": "^1.0.3",
"uuid": "^3.0.1",
"xml2js": "^0.4.17"
},
"devDependencies": {
"nodemon": "^1.11.0"
}
}
I was working but suddenly stopped working, I am able to figure out why, though I had installed pm2 in between but uninstalled, is this the cause that might have broken the logging?
Update
This is how my console looks, no log at all.
Can anyone help with a solution?
Thanks.
You had a typo. I am sure you run this via npm run dev.
Try removing your node_modules folder, and re run npm install

KeystoneJS can't update post

UPDATE It seems the problem is I can't update/edit my post. Every time I create a new post, then it enter dead loop. Please help me T-T
Recently I started a program using keystoneJS as my CMS.
Everything goes fine but this Post problem.
I have found if I install keystone-demo via yo keystone(using the KeystoneJS generator made with Yeoman) then publishing post can work, but if I install keystone manually, the problem comes...
In Google Inspect Console, there is a error-
"TypeError: undefined is not an object (evaluating 'refList.expandColumns')"
I guess it is the keystone version problem.
This is my package.json file
{
"name": "keystone-demo",
"version": "1.0.1",
"private": true,
"repository": {
"type": "git",
"url": "https://github.com/JedWatson/keystone-demo.git"
},
"dependencies": {
"keystone": "https://github.com/keystonejs/keystone.git",
"async": "^1.5.0",
"lodash": "^3.10.1",
"csv": "^0.4.6",
"gulp": "^3.9.1",
"gulp-less": "^3.1.0",
"gulp-shell": "^0.5.2",
"gulp-watch": "^4.3.5",
"pug": "^2.0.0-alpha6"
},
"scripts": {
"start": "node keystone.js"
}
}
And this is the package.json file in that can work normally version
{
"name": "keystone",
"version": "0.0.0",
"private": true,
"dependencies": {
"keystone": "^0.3.16",
"async": "^1.5.0",
"underscore": "^1.8.3",
"node-sass": "^3.3.2",
"node-sass-middleware": "^0.9.7",
"dotenv": "^1.1.0"
},
"devDependencies": {
"gulp": "^3.7.0",
"gulp-jshint": "^1.9.0",
"jshint-stylish": "^0.1.3",
"gulp-shell": "^0.5.0",
"gulp-watch": "^4.3.5",
"gulp-sass": "^2.0.4"
},
"engines": {
"node": ">=0.10.22",
"npm": ">=1.3.14"
},
"scripts": {
"start": "node keystone.js"
},
"main": "keystone.js"
}
You're loading the latest keystone version from github, which is not always stable. This is probably the reason for the error you're seeing.
I recommend using the latest version published to npm (0.3.22 at time of writing) instead.
Update the first line in your dependencies to this, and it will work:
"keystone": "^0.3.22",
To add keystone to a new project you can also type npm install --save keystone

Categories

Resources