Installation of a scoped package resolve in an E404 - node.js

So I came across this problem when I am trying to install the request-promise module via npm.
It depends on a scoped package named #request/promise-core, and when I try to launch npm install request-promise from my project directory it returns me an error 404. This apparently it is a known issue, see: https://github.com/request/request-promise/issues/137, but none of the solutions works for me, probably due to a wrong implementation on my side.
What I tried so far:
configured npm config set "#request:registry" https://registry.npmjs.org/, but did not worked. Still returning E404
tried to manually install the package via github with npm install https://github.com/request/request-promise but no joy since it returns error: ENOEN when trying to open the request-promise-unpack/package.json file.
Probably I am missing some basic steps when trying to install the module, but I cannot figure out a different way of installing that module.
Any suggestions or alternatives is very appreciated.

I fixed with
npm install -g npm
in the terminal and then I could install it:
npm install --save request-promise

Related

node js npm package installation not completed

I try to install node js npm packages, but It start to install and unfortunately freezes. I also try to install angular packages and it doesn't any problem. please help to fix this issue.
node version is 12.13.1;
npm version is 6.12.1;
I tried to install packages this way
npm i html-to-xlsx
here is a result:
another installation result:
Try the following commands then re-run the command:
npm cache clean --force
npm cache verify
And make sure you are in a place with good internet connection. Sometimes this is the issue.
I found way to fix this issue. I add -g before package name
npm install -g html-to-xlsx
Everything looks good
After that I enter this path C:\Users{USERNAME}\AppData\Roaming\npm\node_modules and copy needful module into my working folder

NPM get prefix issues

I am having issues with the npm. (on MAC)
I installed node and npm normally, but couldn't run:
$npm install -g angular-cli
it says unhandled rejection error, EACCESS: ...
and none of the solutions I found on the web couldn't help me.
I tried to reinstall node and npm multiple times, didn't help.
Then I tried to make an ionic project through the terminal, unsuccessfully. Similar issue EACCESS: permission denied...
And now I kind of messed up something with:
$npm config get prefix and $npm config set prefix
whenever I try to run some npm command I get a bunch of lines:
Eaccess, cannot read property, etc...
Does anybody know how can I solve this?
Is there a way to completely remove nodejs and npm and then to install it from scratch.
The traditional way and using homebrew didn't help me.
Try: nvm uninstall {version of node you are using}
To get the version do: npm -version

How to use NPM programmatically?

After seeing this post and other resources, I wanted to try using NPM programmatically so simply I tried:
const npm = require('npm');
but I run into an error of Error: Cannot find module 'npm'.
I did some research and all I saw was to try running npm install npm#latest -g which just updates NPM if I'm not mistaken but I ran it anyways and no change. NPM is already installed globally and I did try installing it locally which got rid of the error but broke the rest of my project so I assume there's a reason that wasn't recommended.
All of the posts I've seen have been older so is this not supported anymore? All the documentation I can find is about the cli and not using it as a module.
Use
$ npm i npm
without the global -g Flag
Note: The NPM API is not intended for external use (even tho it is somewhat documented). The problem is, the NPM API does not guarantee stability. In fact, it doesn't even follow semantic versioning. An update to the NPM API is likely to break your script if you heavily rely on it.
If you want to use NPM externally, it would be better to use it as it is right now: a command-line program.

I can't install npm not matter what I do

So I'm trying to get myself a good Discord Selfbot and one of them requires nodejs, then it said to do npm install. But it gave me an error. I tried again again again and again but nothing worked. The latest thing I did was installing nodejs via scoop but I get this error trying to install npm. Is there a way to do this manually or something? I've tried installing different versions but nothing. I believe scoop installed the latest version.
Here's the image. (the red squares cover up just names)
You have npm already installed, seems that the problem is you don't have a package.json in that location. It says ENOENT: No such file or directory
You already have npm installed! npm is a package manager for installing nodejs packages. Try running some nonsense command (like "lkajshdflhsf") and you'll see what it looks like if you actually didn't have npm installed. What npm install does is install some package. So, for example, if you want to install a node package called Blah, you would run npm intall blah.

Node.js modules installed through npm not recognized

So I've installed and reinstalled node.js many times and tried various installs of the npm. I am currently on node version 0.6.11. When I try to install a new module with npm I get several errors. I am extremely new to programming with node but I have tried researching this problem but haven't found a proper answer. When I install a module with npm and then try to use it in command prompt nothing happens. All I get is for example
'haraka' is not recognized as an internal or external command,
operable program or batch file.
This happens to every module I install. What am I missing here. Please help. I am getting really frustrated with node
By default, npm will install packages locally, in ./node_modules. So if you are in /home/foo:
user#host:/home/foo$ npm install Haraka
Haraka will be installed in /home/foo/node_modules/Haraka. If you want to install a module globally (by default in /usr/local/lib/node_modules), supply the -g switch:
user#host:/home/foo$ sudo npm install -g Haraka
Haraka will be installed in /usr/local/lib/node_modules/Haraka, and the command haraka will be symlinked to /usr/local/bin/haraka.
It's recommended that any dependencies be installed locally. This way, you never have to bother with different packages requiring different versions of their dependencies, aka "dependency hell". I have all my projects in ~/development/projects, and each node project has it's own node_modules folder.

Resources