error in npm install inspite of changing the file Bson - node.js

using mongodb3.0, node 0.12.0, npm 2.5.1 on windows 7 integrale, I am trying to read and write data into my database, but i have this error in npm intsall!
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
i tried to replace
bson = require('../build/Release/bson');
into
bson = require('../browser_build/bson');
but i had errors like this:
exports.BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0 TypeError: Cannot set property 'BSON_BINARY_SUBTYPE_DEFAULT' of undefined
i am using monk, anfd i have run npm mongodb, npm monk

Problem: Modules like Mongo-DB, Socket.io and other requires node-gyp to compile C/C++ code which Kim also discussed. MSVC++ comes only for 32-bit OS, NOW this is the real problem because if you've install node.js and the other requirments like Python 2.7.3 with the 64-bit versions, then you'll face the problems like I did.
Follow these steps:
Uninstall Node.js
Uninstall all the Modules including Python
Now Install 32-bit versions of all the above uninstalled applications and platforms.
Follow all the necessary steps.
Now install modules you want to use.
You may see some errors while installing, but don't panic. Try running your application and it will work just fine.
NOTE: This solution is platform specific i.e. for MS Windows.

I'm on windows 8.1, but what I did, was first install python 2.7.9 and also visual studio community edition. Both are needed to compile bson. Then I installed: "npm install -g node-gyp", after that I just deleted the node_modules from my project and did "npm install" again. Solved. When I did the install again I could see the message on the console that said bson was compiling.

MongoDB depends on a few libraries. At some point you would have done:
npm install mongodb --save
One of these dependencies is node-gyp which is needed to compile bson. Importantly, node-gyp requires Python 2.7 and Microsoft Visual Studio to be installed (see installation section of node-gyp). If you don't have Python 2.7 and Visual Studio, then node-gyp will fail to build which means it can't compile bson (causing the initial error).
Navigate to: node_modules\mongodb\node_modules\mongodb-core\node_modules\bson
You should find the builderror.log file with more information about why node-gyp failed to build. Most likely this will be due to Python 2.7 or Visual Studio not being installed.
Here's what I had to do to fix it:
I had the exact same problem as you with the bson module not found error. I also changed the require line as you did and ended up with the same error (exports.BSON...). I then uninstalled monk and mongodb:
npm uninstall mongodb --save
npm uninstall monk --save
Installed Python 2.7 and Microsoft Visual Studio, then installed mongodb and monk again:
npm install mongodb --save
npm install monk --save
This fixed it.

The problem is fixed when i changed the version of node 10.34 and nom 1.4.28

Related

npm install doesn't work because of node-sass on ubuntu

I'm trying to npm install a project on Ubuntu but I'm getting this error:
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93)
The solutions I found on Stack Overflow was to run npm rebuild node-sass, like in this thread:
Node Sass does not yet support your current environment: Linux 64-bit with false
When I first tried this solution I got this error:
npm - “Can't find Python executable ”python“, you can set the PYTHON env variable.”
and the solution I found for it was to install Python 2.7, from here:
Can't find Python executable "python"
Now when I run python --version I get: Python 2.7.18
So I removed the node_modules folder and the lock file, and run npm install again, but it didn't work, and now I'm getting a build error, which you can find in this gist:
https://gist.github.com/aimad-majdou/b99c5295b56fd5bc68492fa638d63018
I never had issues installing this project on Mac OS and Windows, but this is the first time I try to install it on Ubuntu.
How can I solve this?
There are two solutions for this.
1. Fix python install for npm
You can tell npm to use the correct version of python by running the following command:
npm config set python python2.7
Hopefully after this you can build node-sass.
However, I personally use another solution:
2. Stop using node-sass
There is a pure-javascript sass implementation on npm called sass. It is compatible with node-sass. Just replace node-sass with sass.
Of course, often you did not decide which sass module to use. Usually some framework like React decided to use binary modules like node-sass so you are forced to use it. Well, you can override it in your projcet.
Open your package.json file and edit the node-sass line in the dependencies to:
"dependencies": {
...
"node-sass": "npm:sass#^1.30.0",
...
}
This tells npm to install sass version 1.30.0 as node-sass. Since the sass from the sass module command is compatible with the sass command from node-sass you can now build your project without worrying about building sass. Of course you can use a more recent version of sass if you like.
I see from the gist, that you're running node version 16.x on your ubuntu. As can be seen here, it is probably a version incompatibility between node 16 and the version of node-sass you're trying to build. You should be using at least version 6.0.1 of node-sass for node 16 support.

error in npm start vs code , react project

H!
i tryin to run my React Project using npm start command in terminal :
npm v7.4.3
node v15.7.0
error in terminal
./src/index.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/index.scss)
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
and face this error in localhost:8888
Failed to compile
./src/index.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/index.scss)
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
i trying tso solve problem with this commands
npm rebuild node-sass
and other way was reinstall node-sass
im trying to delete node_modules and run npm install
but seem doesnt work for me.
any answers ?
Downgrade node.js to a stable version (LTS) like 14.15.4
Install the compatible node-sass version via npm install node-sass#5.0.0; you can find the list here or use the GitHub releases page, or even install gulp-sass with npm i gulp-sass`.

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x

I get following error message when running gulp:
Error: Missing binding Z:\Themewagon\Premium\sparrow\zcore\node_modules\node-sass\vendor\win32-x64-48\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x
Found bindings for the following Environments: Linux 64-bit with Node.js 7.x
To resolve this error I tried:
npm install node-sass,
npm rebuild node-sass,
npm uninstall -save node-sass,
npm install -save node-sass,
npm cache clean. etc
Nothing is working for me. How do I resolve this issue.
This happens when you have 2 versions of Node installed, add node-sass with one and run it for the other.
Example Visual Studio ships with Node 5 (at least VS2017 does). If you have installed another version of node (say v6) and install node-sass using that. When it installs it binds to the version to version 6. You can then never run gulp via Visual studio (under Node 5) it fails with the error.
To fix this you can make visual studio use the version you have installed on your system. Add the entry to top of the list to your node location:

NPM install BCRYPT error: MSB8003

I'm trying to install the bcrypt package with the command line
npm install bcrypt
But the prompt returns an error:
I've installed Microsoft Visual Studio 2015, i tried wth --msvs_version=2015 but i still had this error. Could you help me?
I'm using Windows 10 x64, Node.js 0.12.7, npm 2.11.3 and node-gyp 2.0.2
Follow the instruction properly given in node-gyp and bcrypt.
Which require proper python version , visual studio etc..
or you can also use
https://www.npmjs.com/package/bcryptjs
Which doesnot have any depedency like vistual studio on Windows machine.

npm install jsdom error on windows?

I have installed nodejs on my windows pc. And it was working fine. But when I tried to install jsdom using
"npm install jsdom" I was prompoted by this error.
node "C:\Program
Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js"
rebuild info it
worked if it ends with ok
ERR! Error: Python does not seem to be installed
at failNoPython (C:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:78:14)
at Object.oncomplete (C:\Program
Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:66:11)
ERR! not ok
npm WARN optional dependency failed, continuing contextify#0.1.2
jsdom#0.2.13 ./node_modules/jsdom
+-- cssom#0.2.3 +-- htmlparser#1.7.5
Can anyone help me regarding this problem?
I had the same issue on Windows 7 (x64 Ultimate), after hours of search and trials, here is how I resolved it. Please follow the steps in the same exact order:
Install Visual Studio 2010/2012 C++ (Express or higher)
Install Windows SDK 7.1
Install "Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1"
Install GTK (C:\GTK)
Install Python (C:\Python27)
Install node.js (x86)
Add [node.js] to path (C:\Program Files (x86)\nodejs\;)
Add [python] to path (C:\Python27\;)
Add [GTK] to path (C:\GTK\bin;)
Add [WindowsSDKDir] System Variable pointing to "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin"
Run "Windows SDK 7.1 Command Prompt" as Administrator
Set environment to x86 using "setenv /x86"
Change directory to "C:\Program Files (x86)\nodejs\"
Run "npm install -g npm"
Run "npm update -g npm"
Run "npm install -g node-gyp"
Run "node-gyp configure build"
Run "npm install jsdom"
Run "npm install ajax"
Run "npm install http-server"
Run "npm install jquery"
Run "npm install xmlhttprequest"
Run "npm update"
I hope this helps.
There is a nice guide to getting JSDom working on Windows here: http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/
jsdom has a dependency on contextify, which only recently supports windows. You'll need python and a C++ compiler to install it.
You may also need to do the following
npm install -g node-gyp
node-gyp configure
For windows 8 64-bit, installing zmq and protobuf, the following worked for me:
First, Install Visual Studio 2012
Then, on the command prompt (in your project directory):
SET VisualStudioVersion=11.0
npm install zmq
npm install protobuf
npm install jsdom
jsdom uses contextify for running JavaScript on the DOM. And contextify requires native C++ compiler. According to the official readme, on Windows platform, one has to install:
A recent copy of the x86 version of Node.js for Windows, not the x64 version. (should be okay by default)
A copy of Visual C++ 2010 Express. (or any newer version)
A copy of Python 2.7, installed in the default location of C:\Python27.
If you have python installed already, you would need to add the python install directory to the PATH environment variable.
Assuming that python.exe is in the C:\Python32\ directory, on the DOS prompt you need to type:
set PATH=%PATH%;C:\Python32\;
and then:
node-gyp configure
should work fine without that error.
After almost a half year of solving this issue, reading all forums related to this, I finally found the solution.
What I did was simple in my case because I don't use many apps on this computer.
My Windows 8.1 had many programs installed which confused the NodeJS probably (Frameworks, VS addons, etc.).
So I simply did this:
Removed all programs from MS, that I installed once.
Uninstalled Nodejs
For sure I cleaned the registry with CCleaner
Removed Python, Node-gyp and other apps related to Node.js
Then I reinstalled Node.js with optimism for JSdom which installed correctly, but crashed while running my project. So I searched for the new error which - again - has a simple solution. I had to install an older version of JSdom.
npm install jsdom#4.2.0
Finally, everything works. Hope that helps anyone with this issue.

Resources