npm install not working, module not found, tried seemingly everything - mysql

I have had no issues with installing modules up until now, and I'm not sure what went wrong, as I haven't changed my workflow at all.
I ran:
npm i --save mariadb
in the root directory of my Node project. Then I imported this module:
const mariadb = require("mariadb")
When I try to run, though, I get
Error: Cannot find module 'mariadb'
Looking in node_modules, mariadb indeed is in there, but then looking in package.json, mariadb is not listed in dependencies. I then tried running
npm install --save mariadb
in the src directory to same effect. Then tried
npm install -g mariadb
to same effect. Then tried
rm -rf node_modules
npm install
Same effect, and I also get this error (I assume it must be related somehow):
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/codyray/github.com/cody-a-ray/neighbors/client/node_modules/fsevents
gyp ERR! node -v v12.14.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
> core-js#2.6.11 postinstall /Users/codyray/github.com/cody-a-ray/neighbors/client/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Also, after that last command, every package.json file has the following error:
Problems loading reference 'https://schemastore.azurewebsites.net/schemas/json/package.json': Unable to load schema from 'https://schemastore.azurewebsites.net/schemas/json/package.json': getaddrinfo ENOTFOUND schemastore.azurewebsites.net.
I have no idea what any of this means. Seems very cryptic.
I then tried just manually adding mariadb to my package.json and running
npm install --save
again, to no effect.
God help me

Maybe you should try
npm install mariadb --save
I see you are putting in the wrong order, for more information run this command on your console:
npm help install

Related

How to install pm2-logrotate

I am trying to install pm2-logrotate,
sudo pm2 install pm2-logrotate
I am getting
[PM2][Module] Installing NPM pm2-logrotate module
[PM2][Module] Calling [NPM] to install pm2-logrotate ...
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/pm2-logrotate failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
npm ERR! A complete log of this run can be found in:
npm ERR! /home/moveoadm/.npm/_logs/2022-09-11T12_58_10_842Z-debug.log
[PM2][ERROR] Installation failed via NPM, module has been restored to prev version
Looks like npm cannot resolve registry.npmjs.org, i.e. it not connected to Internet.
There are a lot of reasons, for instance, docker configuration - look at What's the cause of the error 'getaddrinfo EAI_AGAIN'?

How to resolve error: EACCES: permission denied when installing Polymer 2.0

Running into an issue trying to install Polymer 2.0
I have node v 8.9.1 installed as well as bower 1.8.2.
To install polymer 2.0, I used the following statements directly from the Polymer install docs:
npm install -g polymer-cli
However, I keep running into this error and don't know how to get around it.
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated babel-preset-es2015#6.24.1: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated #types/assert#0.0.29: See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/12826
npm ERR! path /usr/local/bin/polymer
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall unlink
npm ERR! Error: EACCES: permission denied, unlink '/usr/local/bin/polymer'
npm ERR! { Error: EACCES: permission denied, unlink '/usr/local/bin/polymer'
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, unlink '/usr/local/bin/polymer'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'unlink',
npm ERR! path: '/usr/local/bin/polymer' },
npm ERR! stack: 'Error: EACCES: permission denied, unlink \'/usr/local/bin/polymer\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'unlink',
npm ERR! path: '/usr/local/bin/polymer' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jdk588/.npm/_logs/2017-12-04T14_51_46_451Z-debug.log
I've tried running the command with sudo and still no luck.
I am not sure this is the solution but here below from the Polymer page :
What versions of Node.js do we support?
We support all "Current" and "Active LTS" releases of Node.js according to the Node.js Long Term Support Release Schedule, but not "Maintenance" releases.
This means we will support from two to three semver major versions of Node.js, depending on where we are in the Node LTS schedule. Currently we support 6.x and 7.x.
So, try to downgrade the Node ver. to 6.x or 7.x

What is missing from my PeP proxy installation?

I am following this tutorial to install PeP proxy.
I have installed both node and npm on my CentOS 6.7:
[root#centos fi-ware-pep-proxy]# node -v
v0.10.41
[root#centos fi-ware-pep-proxy]# npm -v
1.4.29
But when I get into the fi-ware-pep-proxy folder and and run npm install, I get the following error:
[root#centos fi-ware-pep-proxy]# npm install
npm WARN deprecated This version of npm lacks support for important features,
npm WARN deprecated such as scoped packages, offered by the primary npm
npm WARN deprecated registry. Consider upgrading to at least npm#2, if not the
npm WARN deprecated latest stable version. To upgrade to npm#2, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest-2
npm WARN deprecated
npm WARN deprecated To upgrade to the latest stable version, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest
npm WARN deprecated
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with `sudo`, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm#2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
-
> node-expat#2.1.4 install /root/fi-ware-pep-proxy/node_modules/xml2json/node_modules/node-expat
> node-gyp rebuild
make: Entering directory `/root/fi-ware-pep-proxy/node_modules/xml2json/node_modules/node-expat/build'
CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
make: cc: Command not found
make: *** [Release/obj.target/expat/deps/libexpat/lib/xmlparse.o] Error 127
make: Leaving directory `/root/fi-ware-pep-proxy/node_modules/xml2json/node_modules/node-expat/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/fi-ware-pep-proxy/node_modules/xml2json/node_modules/node-expat
gyp ERR! node -v v0.10.41
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! node-expat#2.1.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat#2.1.4 install script.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls node-expat
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-573.8.1.el6.x86_64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /root/fi-ware-pep-proxy
npm ERR! node -v v0.10.41
npm ERR! npm -v 1.4.29
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
I tried looking for expat-devel which I also yum installed, but the error remains the same.
I also checked my python version and saw that it is:
[root#centos fi-ware-pep-proxy]# python -V
Python 2.6.6
Does anyone have a clue how I can solve this issue?
Thanks to #Álvaro Alonso I came to the conclusion that I should install gcc:
sudo yum install gcc gcc-c++
as explained here:
https://www.vultr.com/docs/how-to-install-gcc-on-centos-6
Thank you!

libxmljs installation : /bin/sh: 1: node: not found

I am trying to install libxmljs on Ubuntu Server 12
I ran the following command
sudo npm install libxmljs
and i get the following error.
npm http GET https://registry.npmjs.org/libxmljs
npm http 304 https://registry.npmjs.org/libxmljs
npm http GET https://registry.npmjs.org/bindings/1.1.1
npm http GET https://registry.npmjs.org/nan/1.1.2
npm http 304 https://registry.npmjs.org/nan/1.1.2
npm http 304 https://registry.npmjs.org/bindings/1.1.1
> libxmljs#0.10.0 install /home/xxx/node_modules/libxmljs
> node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-24-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/sysadmin/node_modules/libxmljs
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! weird error 1
npm ERR! not ok code 0
Please help.
I had a similar problem and could fix it with. Probably the binary name changed from nodejs to node in a more recent version.
ln -s /usr/bin/nodejs /usr/local/bin/node

npm package build failing, how best to debug?

I'm trying to install a mysql node package on Mac OS X. I'm trying to run a client project locally.
I have node and npm installed already and they work fine, other packages have installed fine. I've also compiled/installed the full LAMP stack.
When the build below fails, I'm not seeing any error messages that are helpful - just information about a library not being found. Without knowing what it can't find, I can't fix it.
Any advice? MySQL has been installed the standard way - downloaded packages, ./configure'd, make/install.
$ npm install mysql-libmysqlclient
npm http GET https://registry.npmjs.org/mysql-libmysqlclient
npm http 304 https://registry.npmjs.org/mysql-libmysqlclient
> mysql-libmysqlclient#1.3.3 install /Users/botskonet/node_modules/mysql-libmysqlclient
> node-gyp rebuild
info it worked if it ends with ok
spawn python [ '/Users/botskonet/.node-gyp/0.6.12/tools/gyp_addon',
'binding.gyp',
'-I/Users/botskonet/node_modules/mysql-libmysqlclient/build/config.gypi',
'-f',
'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_connection.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_result.o
CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_statement.o
SOLINK_MODULE(target) Release/mysql_bindings.node
ld: library not found for -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [Release/mysql_bindings.node] Error 1
ERR! Error: `make` failed with exit code: 2
at Array.0 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:176:25)
at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok
npm ERR! mysql-libmysqlclient#1.3.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the mysql-libmysqlclient#1.3.3 install script.
npm ERR! This is most likely a problem with the mysql-libmysqlclient package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls mysql-libmysqlclient
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "mysql-libmysqlclient"
npm ERR! cwd /Users/botskonet/Sites/SportsBuddies
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.15
npm ERR! code ELIFECYCLE
npm ERR! message mysql-libmysqlclient#1.3.3 install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/botskonet/Sites/SportsBuddies/npm-debug.log
npm not ok
Look at the dependencies section in README and issues #107. To build mysql-libmysqlclient you should install both libmysqlclient and development headers for it, add path to your MySQL bin dir to $PATH and path to your MySQL lib dir to $DYLD_LIBRARY_PATH.