npm install return: mongodb is not in the npm registry - node.js

I'm beginner in nodeJs I want to install the environment to make login page with mongodb,
I create this package.json:
{
"name": "loginapp",
"version": "1.0.0",
"description": "simple app",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "test test",
"license": "ISC",
"dependencies":{
"bcryptjs":"*",
"body-parser":"*",
"connect-flash":"*",
"cookie-parser":"^1.4.1",
"express":"*",
"express-handlebars":"*",
"express-messages":"*",
"express-session":"*",
"express-validator":"*",
"mongobd":"*",
"mongoose":"*",
"passport":"*",
"passport-http":"*",
"passport-local":"*"
}
}
and when I wanted to install with npm install I found this error :
img-error
thank's for helping ..

Related

npm ERR! Missing script: "dev"

I am trying to create a Dapp using truffle but when I reach the stage of using the command npm run dev it gives me an error saying MISSING SCRIP. my code is as follows:
{
"name": "eth-vreg",
"version": "1.0.0",
"description": "Blockchain vreg Powered By Ethereum",
"main": "truffle-config.js",
"directories": {
"test": "test"
},
"scripts": {
"dev": "lite-server",
"test": "echo \"Error: no test specified\" && sexit 1"
},
You need to specify the command to run when executing npm run. in this case node
"scripts": {
"dev": "node lite-server",
"test": "echo \"Error: no test specified\" && sexit 1"
}
You can read more about the scripts property here.

"/" is not recognized as an internal or external command

Today, I'm coding a few npm packages and a few things that need to be prepared repeatedly.
So I wanted to code a CLI to get those things done quickly.
Here is the src/cli.js code:
export function cli(args){
console.log(args);
}
Here is the package.json code:
{
"name": "my-project",
"version": "1.0.0",
"description": "A CLI to bootstrap new project",
"main": "src/index.js",
"bin": {
"#kensoni/my-project": "bin/my-project",
"my-project": "bin/my-project"
},
"publishConfig": {
"access": "public"
},
"keywords": [
"cli"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ken Nguyen",
"license": "MIT",
"dependencies": {
"arg": "^5.0.0",
"esm": "^3.2.25",
"inquirer": "^8.1.1"
}
}
Here is the bin/my-project code:
#!/usr/bin/env/ node
require = require('esm')(module /*, options*/);
require('../src/cli').cli(process.argv);
After I execute the command npm link and open a new cmd type my-project, I get the following message:
'"/"' is not recognized as an internal or external command,
operable program or batch file.
I am using these versions:
node: 14.17.1
npm: 7.18.1
Any ideas how it might work.
Thanks in advance.
Remove "/" after env
#!/usr/bin/env node
//...

For some reason, electron-packager is not able to find electron... Any idea what to do?

For some reason, electron-packager can't find the module electron. I have installed it as instructed from the official site, yet it doesn't seem to work. Here is what seems to happen, my package.json, and how I run electron-packager
Package.json
{
"name": "electron-part1",
"version": "1.0.0",
"description": "An electron tutorial",
"main": "index.js",
"jquery": "^3.3.1",
"scripts": {
"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Me",
"license": "ISC",
"devDependencies": {
"electron": "^5.0.3",
"electron-packager": "^8.7.2"
},
"dependencies": {
"custom-electron-titlebar": "^3.2.5",
"jquery": "^3.5.1"
}
}
What happens:
How I call electron-packager:
electron-packager . electron-part1 --platform=win32 --arch=x64
I fixed it! If anyone else is having the same problem, copy electron from %USERPROFILE%\AppData\Roaming\npm\node_modules, and paste it to node modules in your main folder (The one with package.json) then you can package it as normal

NPM Excluding files automatically >

I am trying to publish a package on npm. It's poppler's pdftotext portable.
The lib folder structure is like this:
"lib/libjpeg.so.9",
"lib/libjpeg.so.9.2.0",
"lib/libjpeg.so.9.2.0",
"lib/libpoppler.so",
"lib/libpoppler.so.98",
"lib/libpoppler.so.98.0.0"
but when I pack it, npm automatically removed other files and only keeps libjpeg 9.2.0 and libpoppler.so.98.0.0
Why are other files removed? There is no ignore file; no npmignore nor gigignore.
The type of removed file is Link to shared library (application/x-sharedlib) How can I include them as well ?
This is complete package.json
{
"name": "packname",
"version": "0.0.2",
"description": "dis",
"main": "index.js",
"directories": {
"lib": "lib"
},
"files": [
"bin",
"lib"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": ""
}

npm link is not working, bash: dosmth: command not found

I am trying to do basic CLI with node, but seems like it is not linking from/to correct directory.
I have file named create, which contains command: console.log(process.cwd());
When I run in bash node create, it gives me that outcome:
/Users/katya/Desktop/code/drawer.
However, after running npm link (or sudo npm link), it prints that:
/Users/katya/.npm-packages/bin/dosmth -> /Users/katya/.npm-packages/lib/node_modules/drawer/create
/Users/katya/.npm-packages/lib/node_modules/drawer -> /Users/katya/Desktop/code/drawer
and after that if I run dosmth in bash I get:
bash: dosmth: command not found
I assume there is something to do with ./npm-packages/ appearing in the path.
I tried to delete node completely from computer and install again but did not help.
If you have any idea I would really appreciate your help.
My package.json:
{
"name": "drawer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": {
"dosmth": "create"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Have you tried changing bin to point to your index.js?
{
// Other keys ...
"bin": {
"dosmth": "./index.js"
},
//...
}

Resources