Error when trying to run Node.js Ubuntu project in Mac: - mysql

I am working with Node.js, Express.js and sqlite3 to create a small website.
I have developed my project in Ubuntu and I have been trying to get it to work in Mac also.
But after I svn checkout from my repository the folder of the project, and try to run my app.js file I get the following error:
module.js:356
Module._extensions[extension](this, filename);
^
Error: dlopen(/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/build/Release/node_sqlite3.node, 1): no suitable image found. Did find:
/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/build/Release/node_sqlite3.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/cs205g1s13/BS/baby_skype_less/node_modules/sqlite3/lib/sqlite3.js:1:104)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
The website works fine on Ubuntu. And also, the Mac computer has Node.js, sqlite3. Any help of why this is happening would be appreciated.
I removed the node_modules from my svn repository, and svn checkout my project folder into a mac computer. When I do npm install sqlite3 I get the following errors:
$ npm install sqlite3
npm WARN package.json application-name#0.0.1 No README.md file found!
npm http GET https://registry.npmjs.org/sqlite3
npm http 304 https://registry.npmjs.org/sqlite3
sqlite3#2.1.7 install /Users/cs205g1s13/BS/playing/node_modules/sqlite3
node-gyp rebuild
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp", line 15, in <module>
import gyp
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
import gyp.input
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 15, in <module>
import multiprocessing
ImportError: No module named multiprocessing
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:415:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node- gyp.js" "rebuild"
gyp ERR! cwd /Users/cs205g1s13/BS/playing/node_modules/sqlite3
gyp ERR! node -v v0.10.4
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
npm ERR! sqlite3#2.1.7 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the sqlite3#2.1.7 install script.
npm ERR! This is most likely a problem with the sqlite3 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 sqlite3
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "sqlite3"
npm ERR! cwd /Users/cs205g1s13/BS/playing
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/cs205g1s13/BS/playing/npm-debug.log
npm ERR! not ok code 0

Did you check in your node_modules folder into svn? Don't do that. To fix it, run npm rebuild on your Ubuntu box. sqlite uses extensions that must be compiled on the host platform.

Related

Failed to Install SASS - MacOS Mojave 10.14.6

Today I tried to install node-sass using: npm i -g node-sass
but it keeps getting failed. Can anyone help?
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/huynguyen/.npm/_logs/2020-08-21T14_55_03_284Z-debug.log
Assuming this on OS X, you can try
sudo chown -R $USER /usr/local/lib/node_modules
so that huynguyen will have write access.

gulp init ask for a local install but I have the CLI version

I am trying to compile my sass with gulp but when I try the command (in my project):
gulp init it gives me the error message:
Local gulp not found in ~/Desktop/templateWebsite
[09:01:31] Try running: npm install gulp
I have the gulp CLI gobaly installed but it still does not work.
sudo npm install -g gulp-cli
I found some possible solutions on Stack Overflow but they didn't work. Also I tried different version of gulp CLI.
i also tryed to install gulp localy:
sebastians-mbp:templateWebsite sebastiantramper$ sudo npm install gulp
Password:
> fsevents#1.2.7 install /Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents
> node install
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for fsevents#1.2.7 and node#11.6.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/lib'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/build'
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents
gyp ERR! node -v v11.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:188:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents
node-pre-gyp ERR! node -v v11.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/sebastiantramper/Desktop/templateWebsite/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
npm WARN saveError ENOENT: no such file or directory, open '/Users/sebastiantramper/Desktop/templateWebsite/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users/sebastiantramper/Desktop/templateWebsite/package.json'
npm WARN templateWebsite No description
npm WARN templateWebsite No repository field.
npm WARN templateWebsite No README data
npm WARN templateWebsite No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ gulp#4.0.0

gulp.js Plugin uncss can't be installed

I want to install/use the Gulp-Plugin uncss (https://www.npmjs.com/package/gulp-un-css/) as my very first gulp-"try".
I therefore installed npm and Gulp successfully globally with the CLI version 3.9.1. I also installed the uncss-plugin with npm install gulp-uncss --save-dev and with sudo npm install gulp-uncss --save-dev.
At the end of that, I get the same message within the terminal:
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/me/project/front/node_modules/gulp-uncss/node_modules/uncss/node_modules/phridge/node_modules/phantomjs-prebuilt/node_modules/request/node_modules/hawk/lib/index.js:5:33)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
npm ERR! phantomjs-prebuilt#2.1.16 install: `node install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt#2.1.16 install script.
npm ERR! This is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 15.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "gulp-uncss" "--save-dev"
npm ERR! cwd /Users/me/project
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! code ELIFECYCLE
npm ERR! Error: ENOENT, lstat '/Users/me/project/node_modules/gulp-uncss/node_modules/uncss/node_modules/request/node_modules/form-data/node_modules/async/node_modules/lodash/throttle.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 15.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "gulp-uncss" "--save-dev"
npm ERR! cwd /Users/me/project
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path /Users/me/project/node_modules/gulp-uncss/node_modules/uncss/node_modules/request/node_modules/form-data/node_modules/async/node_modules/lodash/throttle.js
npm ERR! fstream_path /Users/me/project/node_modules/gulp-uncss/node_modules/uncss/node_modules/request/node_modules/form-data/node_modules/async/node_modules/lodash/throttle.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/me/project/npm-debug.log
npm ERR! not ok code 0
What/How can I solve that?

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

Problems to install Mocha: "Error Parsing Json"

I have a problem installing mocha. I try to install mocha with the following line:
npm install -g mocha
This is the output which I get (If I type the http://registry.npmjs.org/mocha into the browser I'm able to see the json data):
npm http GET http://registry.npmjs.org/mocha
npm http 404 http://registry.npmjs.org/mocha
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token <
npm ERR! <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
npm ERR! <html><head>
npm ERR! <title>404 Not Found</title>
npm ERR! </head><body>
npm ERR! <h1>Not Found</h1>
npm ERR! <p>The requested URL /mocha was not found on this server.</p>
npm ERR! </body></html>
npm ERR!
npm ERR! at Object.parse (native)
npm ERR! at RegClient.<anonymous> (C:\Program Files\nodejs\node_modules\npm\
node_modules\npm-registry-client\lib\request.js:203:23)
npm ERR! at Request.self.callback (C:\Program Files\nodejs\node_modules\npm\
node_modules\request\request.js:123:22)
npm ERR! at Request.EventEmitter.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\no
de_modules\request\request.js:893:14)
npm ERR! at Request.EventEmitter.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_module
s\npm\node_modules\request\request.js:844:12)
npm ERR! at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR! at _stream_readable.js:920:16
npm ERR! at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "mocha"
npm ERR! cwd C:\Users\myName
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! type unexpected_token
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\myName\npm-debug.log
npm ERR! not ok code 0
After hours trying to resolve this issue I found this solution:
The problem which I had is connected to the proxy settings of npm. Which means that npm was not able to load the json file correctly.
You have to set the proxy settings first:
npm config set proxy http://username:password#YourProxy:Port
npm config set https-proxy https://username:password#YourProxy:Port (If you have one)