App stops working after updating npm and node on MacOS - javascript

So I've made the big mistake of updating npm and node from versions 3.10.10 and 6.10.2, respectively to 5.6.0 and 9.3.0
Now my app doesn't work so I am getting quite desperate here. When I attempt to run it, I get the following error:
/Users/me/Workspace/MyApp/node_modules/node-sass/lib/binding.js:13
throw new Error(errors.unsupportedEnvironment());
^
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (59)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.5.3
I've looked up the error and haven't found much, except deleting the node_modules folder and doing npm install. Neither of which work. This now gives me the following error:
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v59-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3#3.1.8 and node#9.3.0 (node-v59 ABI) (falling back to source compile with node-gyp)
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c
TOUCH Release/obj.target/deps/action_before_build.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o
I am not sure where to go from here but am not getting desperate. What is going on? Is there anything I can do or should I just reverse to a previous version of node and npm?

You'll need to run npm rebuild, because Node-sass uses C++ addons, and that command
runs the npm build command on the matched folders. This is useful when you install a new version of node, and must recompile all your C++ addons with the new binary.
There's probably also no reason not to update node-sass to the current release 4.7.2.
Have a look at another handy package called ncu that can help you bulk-upgrade your package.json. Don't do it carelessly, you may create instability, but it's a handy start if you have a small number of specified dependencies.

Related

Angular project creation failed because of deprecated circular-json

I used following command to create new angular project
ng new hello-world
It failed showing
npm WARN deprecated circular-json#0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! Unexpected end of JSON input while parsing near '...rocess":"~0.7.0"},"_h'
Then I installed flatted using...
npm i flatted
But the error still occurs.
How to use flatted instead of deprecated library circular-json?
Run following commands that will clean NPM cache
npm cache clean --force
after this run following command
npm install -g #angular/cli#latest
then you can create angular project.
If it doesn't work, even after clearing the cache, which happened in my case:
Make sure you try the ng new create-app command using Powershell in administrator mode.
This worked for me.
I had the same problem. None of the above mentioned answers worked for me.
So I removed the content of .npmrc, ran the generate command and it worked.
After that, you can restore the content of your .npmrc if needed.

Cannot find module '../build/Release/opencv4nodejs

I am new to OpenCV and node js, trying to learn OpenCV in node js.
I came across opencv4nodejs which I found best for learning.
I have followed all steps to install OpenCV and setting environment variables for OpenCV and done npm install opencv4nodejs also. able to run Quick start code given but when I try to run example machineLearningOCR.js from examples folder I get error Error: Cannot find module '../build/Release/opencv4nodejs'
I run command node machineLearningOCR.js from cmd but getting error mentioned above on line const cv = require('../');
How to run examples given in opencv4nodejs?
If you cloned the repository and want to use the examples directly from the examples folder then you have to npm install in the root directory first to build the module.
Optionally you can npm install opencv4nodejs in any project directory, copy the examples into that directory and replace const cv = require('../'); with const cv = require('opencv4nodejs');.
You can also directly submit an issue here: https://github.com/justadudewhohacks/opencv4nodejs/issues
I had the same problem and I did solve the issue with the following steps.
First all of. I checked the npm version, for this case I recommend you updated or pass your software resources at the next version.
NodeJs 14.16.0
NodeJs version: 14.16.0. You can verify the version with this command if you had another NodeJs version installed
node --version
Npm version: 6.4.11 You need verify if you had this version installed only you will able to validate this if you have NodeJs but if you didn't have node you can install the version I recommend you
npm --version
After you set the NodeJs and npm versions you need to verify the following things
Have visual studio 2015 or latest with the development for desktop component
Have cmake program installed
Have git bash
Have Java or the language you will to work
Have the environment variables for the above programs I mentioned
Then you can try again to install open Cv
You need to reopen another or new terminal and then you will execute this command
npm install --save openc4nodejs
And then
npm install -g openc4nodejs
After than or before don't forget to install appium I recommend you 1.19.1 version
You can verify if you have appium with opencv with open Cv doctor you can run appium-doctor and check if the Open cv component are present.
For to install appium doctor you can run this command, npm install -g appium-doctor
I hope this answers will be helpful for you
Autor: Eder Carbonero

All NPM COMMAND not working even I updated .bash_profile

I used npm for several months.
But after I install python/django and virtual environment, it's not working anymore.
The error is smething like this.
sudo npm install -g react-native-cli
module.js:341
throw err;
^Error: Cannot find module './cache/caching-client.js'
I used npm for several days but this happened first time. I searched to solve issue and found this link
Installing MEAN Stack: npm -v module.js: 338 throw err; Error: Cannot find module './cache/caching-client.js'.
But not working.
echo $NODE_PATH
/usr/local/lib/node_modules
And it occurs on all npm commands.
npm -v
npm init -y
I reinstalled the node.js again and it worked.:)
f you added React Native manually to your project, make sure you have included all the relevant dependencies that you are using, like RCTText.xcodeproj, RCTImage.xcodeproj. Next, the binaries built by these dependencies have to be linked to your app binary. Use the Linked Frameworks and Binaries section in the Xcode project settings. More detailed steps are here: Linking Libraries.
If you are using CocoaPods, verify that you have added React along with the subspecs to the Podfile. For example, if you were using the , and fetch() APIs, you would need to add these in your Podfile:
for more see this
https://www.npmjs.com/package/react-native-winjs-cli/tutorial

Error: Module did not self-register.

Server: Ubuntu server 14.04
Node: v4.2.6 LTS
npm: 1.3.10
I pullled my colleage's work from git remote. He made the node_modules as .gitignore. So I have to npm install the modules.
But after a successful install of npm. when I try to start the project using mocha. It remind me of a module didn't self-register
The error comes from the module of Bcrypt.
at bindings (/base_dir/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
I don't want to downgrade my node to 0.10, because, I can't use JS promise in that version. Somehow, JS promise is a must in my work
This problem happens mostly because you copied/cloned the repository from somewhere else, but some modules for nodeJS should be installed/registered locally on your machine, during which the happens the build process(maybe some native language like C).
and be noted that the node_modules folder should not be staged for versioning. and should be ignored by versioning tool. and the one who is trying to clone this package should build / install firstly.
I find the answer to this problem.
But plz don't devoted this just because you want.
I upgrade the NPM using
npm install npm -g.
after that, delete the node_modules folder,
then,
npm install
Everything will be good.
I had this issue while setting up my Cypress project.
After trying to delete and then reinstalling all the node-modules and upgrading everything I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', this way you are telling cypress explicitly to use the node version installed on your machine.
Add this line to your settings file:
**"nodeVersion": "system"**

NodeJs - FTP not working: "npm-shrinkwrap.json is not provided"

I have got a Nodejs app on AppFog and want to connect to a ftp-server with this.
I did install it with npm install ftp using "Ruby Command Prompt"
This is the only code line:
var FTPClient = require('ftp');
Trying to start the app, it throws an error:
Skipping npm-support: npm-shrinkwrap.json is not provided
Which kind of server should I use or what's the problem?
Still doesn't start:
Starting Application 'test007': .
Error: Application [test007] failed to start, logs information below.
====> /logs/staging.log <====
# Logfile created on 2013-03-09 10:37:09 +0000 by logger.rb/25413
Installing dependencies. Node version 0.8.14
Installing ftp#0.2.9 from local path
Installing xregexp#2.0.0 from local path
Installing node#0.0.0 from local path
Installing nodejs#0.0.1 from local path
But no error is shown.
Thanks in advance
The quick fix is to type npm shrinkwrap, which will provide an npm-shrinkwrap file.
A shrinkwrap file fixes the exact versions of your dependencies, and the exact version of their dependencies, and so on. Without it, each usage of npm install could install different versions of the packages -- sometimes, just different bugfix versions (1.4.2 vs 1.4.3), but sometimes much greater differences. There's no guarantee that your code will work with different dependency versions (in fact it is not uncommon to break), so shrinkwrapping is a great idea for any production-level code.
If you want to 'unshrinkwrap', just delete the npm-shrinkwrap.json. You can re-shrinkwrap at any point.

Categories

Resources