Npm 2.x errors on Windows - node.js

I have installed NodeJs 4.2.1 and Npm 2.14.7 successfully on Windows 10 x64, but when at the time of gathering dependencies on my new and clean system I'm having several errors. This is what I have done so far:
I have cloned many examples from take: github https://github.com/developit/express-es6-rest-api to name one, when I run npm install on it everything works fine, but when I run npm start it raises errors for missing packages for instance: babel-core/register, utf8, requests, etc. It seems that npm is not installing the 2nd dependency level way down. How can I fix this?, as I said before I've tried with several tutorials and even with something mine and everything is the same. I need a hand, noob on NodeJS here.

Related

NPM is really slow performing simple tasks

Everything I do with NPM takes several minutes; especially npm install, even if I already have all the packages installed. I first thought the problem is that the old code I am working with just takes longer to update (because last time an older npm version was used) but the problem percists even if I repeat the process.
My system and other Information:
Windows 11 PC
Ubuntu 18.04.5 VM from the Microsoft Store
VS Code.
npm version 8.19.2
node version 16.17.0
From my package-lock.json file: "lockfileVersion": 2
I usally have 5 to 10 dependecies listed in my package file
My internet speed is around 25 MB/s
What I tried so far with no luck:
A newer Version of Ubuntu
Using http instead of https a la:
npm config set registry http://registry.npmjs.org/ --global
as was suggested in 'npm install' extremely slow on Windows.
It seems to me it still tries to connect to the https address (at least that's what it looks like if I use npm install --verbose to show more feedback).
Reinstalling Node and NPM through other means as it was suggested in Why is "npm install" really slow?
No matter what I still sit here, wasting ages waiting for my npm install.
I finaly found a solution. I just did not now to ask the right question.
The problem was that I was using WSL version 2 and my files are in C: and not the Ubuntu folders. A fix that worked for me was moving to WSL version 1.
More details can be found here.
If you're also switching to WSL version 1 and are having problems with node or npm, this might help.

The react-native init hangs on macOS Catalina, with fetchMetadata: sill resolveWithNewModule react-native#0.64.2 checking installable status

I just wanted to create a react native application using react-native init command. But it hangs with the message:
fetchMetadata: sill resolveWithNewModule react-native#0.64.2 checking
installable status
Sure I am not the first one facing the same issue and I found many answers and tried almost all solutions I found while googling it,
Examples are:
Uninstall and reinstall node
Install yarn
Clear npm cache
Install node using home-brew instead of direct installation
npm i -g react-native; then react-native init
and many other solutions, but it is still stuck.
It is not related to the MacOS version or Network connectivity etc anyway; because It worked on another machine with same OS, and on the same network.
I am sure the react native community is familiar with the question and may somebody will say this is already answered and thus will close it, but it still hangs. I don't know what the issue is.
I am not sure it is related to node or npm or some other. Because I faced the same issue, when I tried create-react-app.
I just wanted to know is there any solution to solve the issue?
and
is there anyway the node, npm or npx or other produce some error when it hangs for any reason, may be while downloading some dependency or while running some commands etc; and show some information regarding what is happened and what is missing.
Assuming this is more related to node, npm or npx; as these are responsible for downloading and running the modules and dependencies or it can be because of error handling in react-native init. Whichever, may be assuming everything fine on the machine, and may not be checking and reporting, if something is missing.
Screenshot: React Js and React-Native hangs
Few days after, surprisingly, it started working. I didn't change anything and I was planned to try a fresh installation of everything from OS installation. But now, I got it working, with no notable reason.

Bundling errors after updating an npm package in React Native app

I'm building a React Native app which, at this point, doesn't have too many dependencies.
Every time I update an outdated npm package, I am GUARANTEED to run into bundling errors. It could be any package. I then spend hours trying different ways to clear npm cache, project cache, etc.
Does anyone else have this issue? Is there a "standard" set of commands I should run after upgrading ANY npm package? This is extremely frustrating!
This screen shot shows today's flavor of the issue:
BTW, I'm on Windows 10, using VS Code. My React Native version is 0.63.1, Node version is 14.7.0 and npm version is 6.14.7
UPDATE:
After a couple of hours of messing around and removing node_modules folder several times and issuing the following commands a few times, it's now started to work. Unfortunately, I can't put my finger on what fixed it. As I said, I did the same things a few times.
Here are the steps I repeated a few times -- though once should be enough:
Deleted the node_modules folder
In root folder, I ran npm cache clean --force
I then reinstalled all npm packages by running npm i
Went into cd android folder and ran ./gradlew clean
Then in project root, I ran npm start -- --reset-cache
Unfortunately, doing this the first time didn't fix the issue. It looks like I have to waste a couple of hours for things to get back to normal! Any idea how to make this problem go away for good?
I think this error is that you have not start the metro bundle. Try react-native start and then re-run the app

Cannot find module dtrace-provider

I have a simple nodejs application that is throwing "Cannot find module './build/Release/DTraceProviderBindings'". I look it up online and it looks like that a lot of people are having the same problem when using restify on windows (which is my case, I'm using restify on windows 10). Apparently, dtrace-provider is a optional module for restify and there is no version of it for windows. So, what I tried so far:
Update node to v6.2.0;
Uninstall all modules and run npm install --no-optional;
Uninstall only restify and run npm install restify --no-optional;
And my most desperate move npm install dtrace-provider.
Everything I tried where found on github issues, I've seen same error on OSX users with other modules. Not sure what else to try.
Note: This exception does not stop my application, not even prints the error on the console, I just notice that this was happening using the debugger, in other words, my application runs fine, but this keeps happening on the background.
List of other modules I'm using:
"dependencies": {
"restify": "latest",
"request": ">=2.11.1",
"cheerio": ">=0.10.0",
"xml2js": ">=0.2.0",
"botbuilder": "^0.11.1",
"applicationinsights": "latest"
}
This worked for me after switching to Node 6.1 (and when re-installing node modules didn't work):
Install and save dtrace-provider
$ npm install dtrace-provider --save
Delete 'node_modules' folder
Re-install node modules
$ npm install
I found this thread before combining your attempts with another solution on the Github project issues for restify (https://github.com/restify/node-restify/issues/1093) and simplified best as possible.
I recently ran into this error as well on node 6.11.1.
I ran npm rebuild dtrace-provider and that resolved the problem.
The restify team followed an approach of trying to load the module by requiring it on a try/catch block. You should just ignore the exception.
I had success with the following (elaborate) sequence:
Adjust my path to not have spaces
rm -rf node_modules
rm -rf ~/Library/Caches/node-gyp/
npm cache clean --force
V=1 npm install -S dtrace-provider#0.8.8 --python=python2.7 (repeat this step, resolving as you go, until the install is completely successful … if it fails, check the version - I had rogue dtrace-provider#0.6.0 building at one point)
npm install
At this point everything should have installed cleanly, and I was congratulating myself on a job well done. Then I executed my code and still got the DTraceProviderBindings error. The cause was nested dependencies with the wrong version of dtrace-provider (especially bunyan).
To confirm, do npm list | grep dtrace -B6.
If there's anything lower than 0.8.8, edit package-lock.json, following the method in How do I override nested NPM dependency versions?. Replace requires with dependencies for dtrace-provider and update the version.
Back round to get everything clean: rm -rf node_modules
Then, again, npm install --python=python2.7
I had to iterate round npm list a few times because I thought I'd caught everything and I hadn't.
The key points were to use the required version of python, have a unix-friendly path, and hunt down all nested dependencies. The python version issues gave a big messy error, the space issue gave a much more missable error.
I know this is an old issue but I wanted to comment on it in case anyone else has the same issue I had.
My issue was caused by having parentheses in my path.
/users/karlgroves/Dropbox (Personal)/foo/bar/bat/project...
Moving the project to a path without the parens worked for me.
You'll need to wipe out node_modules and reinstall again.
I recently ran into this error as well on node v8.8.1
as #Derek mentioned, I ran npm rebuild dtrace-provider and that resolved the problem.
tl;dr; dtrace-provider utilized node-gyp which required python version >= 2.5 and NOT 3.5
I had this issue on OSX and found a post that showed using environment variable
V=/Users/your_user/your_project npm i dtrace-provider
This let me know that there was a dependency on node-gyp that was failing to build...Once I knew the issue was with this module was able to focus my attention at troubleshooting node-gyp.
This led to some log output indicating that my python version 3.5 was unsupported and it required version >= 2.5.
Went and downloaded python 2.7.x and checked /usr/bin/python 2.7.x to ensure it was there. Uninstalled the node module that was ultimately requiring this module, then used npm cache clean then reinstalled the module and this time it appeared to pick up the right python version to be able to build.
Hope this helps someone =)
I have tried many suggestions but get the same error again.
Finally, I found the correct way to solve this question.
Go the node.js website and download the latest version of node.js pkg.
After installed, reinstall your software, everything will be ok.
i managed to get this working by running this command
npm install --python=python2.7

Running Gulp Works on One Computer, Not Another

I've got a project of mine that works perfectly fine on my MacBook Air. When I run gulp it runs my default task and serves my site to me.
On my iMac however, when I git clone the same repo, cd into that directory and run npm install, it begins the install and then gives me this error.
npm ERR! cb() never called!
When I run gulp, I get this error:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
Any idea why this works on one computer and not the other? Any help is appreciated. Thanks in advance!
You're missing libsass c bindings.
There are multiple reasons why this could be. Check that your npm version and node and gulp-sass and node-sass versions are identical.
There's also several issues, but I think this one fits your case best based on the vague description available. https://github.com/dlmanning/gulp-sass/issues/174

Resources