MongoDB issue with mongoose - mongodb

This is the message i am getting when i tries to run my new app any one who can fix this issue
^
Error: Cannot find module 'mongodb/node_modules/bson'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object. (C:\wamp\www\NodeExpress\beautiBlog\node_mo
ss-sessions\node_modules\mongoose\lib\drivers\node-mongodb-native\obj
16)
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
[nodemon] app crashed - waiting for file changes before starting...

Try this:
npm install -g node-gyp
cd /to/your/project-folder
rm -rf node_modules
npm install
Source: https://github.com/Automattic/mongoose/issues/2718

Related

SyntaxError: Unexpected token '(' when trying to run pdf2json

When I try to run pdf2json (without any parameters at all) I'm getting this error:
/usr/lib/node_modules/pdf2json/lib/p2jcmd.js:63
#continue(callback, err) {
^
SyntaxError: Unexpected token '('
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/lib/node_modules/pdf2json/bin/pdf2json:3:16)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Here's the Dockerfile I tried to run it in:
FROM debian:bullseye
RUN apt-get update \
&& apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs \
&& npm install pdf2json -g
Any ideas?
Quoting https://github.com/modesty/pdf2json/issues/250:
The problem here is that these were breaking changes but only marked as a new (non-breaking) feature with a minor version increment. So calling npm audit fix actually forces this upgrade and breaks everything. This needs to be re-released as a MAJOR version increment to v2.0 and/or a bug patch released on the 1.x line to make this backwards compatible again.
The solution is to do npm install --save-exact pdf2json#1.2.5.

strawberry perl on windows install Prima failed with no tiff.h

I use strawberry perl on windows. I tried to install Prima module, running
install Prima
in CPAN console, I got
> img\codec_tiff.c:14:10: fatal error: tiff.h: No such file or directory
> #include <tiff.h>
> ^~~~~~~~ compilation terminated. dmake.exe: Error code 129, while making 'img\codec_tiff.o' KARASIK/Prima-1.53.tar.gz
> C:\STRAWB~1\c\bin\dmake.exe -- NOT OK Stopping: 'install' failed for
> 'Prima'. Failed during this command: KARASIK/Prima-1.53.tar.gz
> : make NO
so finally it failed to install Prima. So what to fix missing tiff.h problem?
update
Now I reinstalled the latest strawberry perl version 5.28.1.1
However, installing Prima failed for another reason. Error message as below:
dlltool -l blib/arch/auto/Prima/libPrima.a -d Prima.def -D PRIMA.xs.dll blib\arch\auto\Prima\Prima.xs.dll
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e chmod -- 755 blib\arch\auto\Prima\Prima.xs.dll
"C:\Strawberry\perl\bin\perl.exe" -MExtUtils::Command -e cp -- Prima/VB/VB.pl blib\script\VB.pl
pl2bat.bat blib\script\VB.pl
process_begin: CreateProcess(NULL, pl2bat.bat blib\script\VB.pl, ...) failed.
make (e=2): The system cannot find the file specified.
gmake: *** [Makefile:1165: blib\script\VB.pl] Error 2
KARASIK/Prima-1.53.tar.gz
C:\STRAWB~1\c\bin\gmake.exe -- NOT OK
Stopping: 'install' failed for 'Prima'.
Failed during this command:
KARASIK/Prima-1.53.tar.gz : make NO
And if I run install Prima the second time, it shows
Running install for module 'Prima'
KARASIK/Prima-1.53.tar.gz
Has already been unwrapped into directory C:\STRAWB~1\cpan\build\Prima-1.53-0
KARASIK/Prima-1.53.tar.gz
Has already been prepared
KARASIK/Prima-1.53.tar.gz
Could not make: Unknown error
What should I do?

Dockerizing Nuxt.js app: docker run works but docker-compose doesn't

I'm trying to containerize a Vue.js + Nuxt.js app. The odd thing is that I am able to access the app when I run docker run -p 3000:3000 <image_name> but not when I run a docker-compose up command.
My Dockerfile looks like this:
FROM node:8.9.1-alpine
# Create app dir
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install deps
RUN apk update && apk upgrade && apk add git
COPY package*.json /usr/src/app/
RUN npm install
# If building for production:
# RUN npm install --only=production
COPY . /usr/src/app/
ENV HOST 0.0.0.0
EXPOSE 3000
# Start command
CMD [ "npm", "run", "dev" ]
As aforementioned, running docker build -t <image_name> . and then docker run -p 3000:3000 <image_name> works.
However, with the following docker-compose.yml file:
version: '3'
services:
web:
build: .
ports:
- "3000:3000"
volumes:
- .:/usr/src/app
running docker-compose up results in the following error:
docker-compose up
Creating network "vueui_default" with the default driver
Creating vueui_web_1 ...
Creating vueui_web_1 ... done
Attaching to vueui_web_1
web_1 |
web_1 | > my-app#1.0.0 dev /usr/src/app
web_1 | > nuxt
web_1 |
web_1 | 2017-11-27T06:23:52.962Z nuxt:axios BaseURL: http://localhost:3000/api (Browser: /api)
web_1 | 2017-11-27T06:23:57.822Z nuxt:build App root: /usr/src/app
web_1 | 2017-11-27T06:23:57.823Z nuxt:build Generating /usr/src/app/.nuxt files...
web_1 | 2017-11-27T06:23:57.855Z nuxt:build Generating files...
web_1 | 2017-11-27T06:23:57.883Z nuxt:build Generating routes...
web_1 | 2017-11-27T06:23:58.018Z nuxt:build Building files...
web_1 | 2017-11-27T06:23:58.429Z nuxt:build Adding webpack middleware...
web_1 | ERROR Failed to compile with 3 errors06:24:28
web_1 |
web_1 | error in ./layouts/default.vue
web_1 |
web_1 | Module build failed: Error: Missing binding /usr/src/app/node_modules/node-sass/vendor/linux_musl-x64-57/binding.node
web_1 | Node Sass could not find a binding for your current environment: Linux/musl 64-bit with Node.js 8.x
web_1 |
web_1 | Found bindings for the following environments:
web_1 | - OS X 64-bit with Node.js 9.x
web_1 |
web_1 | This usually happens because your environment has changed since running `npm install`.
web_1 | Run `npm rebuild node-sass --force` to build the binding for your current environment.
web_1 | at module.exports (/usr/src/app/node_modules/node-sass/lib/binding.js:15:13)
web_1 | at Object.<anonymous> (/usr/src/app/node_modules/node-sass/lib/index.js:14:35)
web_1 | at Module._compile (module.js:635:30)
web_1 | at Object.Module._extensions..js (module.js:646:10)
web_1 | at Module.load (module.js:554:32)
web_1 | at tryModuleLoad (module.js:497:12)
web_1 | at Function.Module._load (module.js:489:3)
web_1 | at Module.require (module.js:579:17)
web_1 | at require (internal/module.js:11:18)
web_1 | at Object.<anonymous> (/usr/src/app/node_modules/sass-loader/lib/loader.js:3:14)
web_1 | at Module._compile (module.js:635:30)
web_1 | at Object.Module._extensions..js (module.js:646:10)
web_1 | at Module.load (module.js:554:32)
web_1 | at tryModuleLoad (module.js:497:12)
web_1 | at Function.Module._load (module.js:489:3)
web_1 | at Module.require (module.js:579:17)
web_1 |
web_1 | # ./node_modules/vue-style-loader?{"sourceMap":true}!./node_modules/css-loader?{"minimize":true,"importLoaders":1,"sourceMap":true,"alias":{"/static":"/usr/src/app/static","/assets":"/usr/src/app/assets"}}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-314f53c6","scoped":false,"hasInlineConfig":true}!./node_modules/sass-loader/lib/loader.js?{"indentedSyntax":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./layouts/default.vue 4:14-499 13:3-17:5 14:22-507
web_1 | # ./layouts/default.vue
web_1 | # ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["/usr/src/app/node_modules/babel-preset-vue-app/dist/index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./.nuxt/App.vue
web_1 | # ./.nuxt/App.vue
web_1 | # ./.nuxt/index.js
web_1 | # ./.nuxt/client.js
web_1 | # multi webpack-hot-middleware/client?name=client&reload=true&timeout=3000&path=/__webpack_hmr ./.nuxt/client.js
web_1 |
web_1 | error in ./layouts/plain.vue
web_1 |
web_1 | Module build failed: Error: Missing binding /usr/src/app/node_modules/node-sass/vendor/linux_musl-x64-57/binding.node
web_1 | Node Sass could not find a binding for your current environment: Linux/musl 64-bit with Node.js 8.x
web_1 |
web_1 | Found bindings for the following environments:
web_1 | - OS X 64-bit with Node.js 9.x
web_1 |
web_1 | This usually happens because your environment has changed since running `npm install`.
web_1 | Run `npm rebuild node-sass --force` to build the binding for your current environment.
web_1 | at module.exports (/usr/src/app/node_modules/node-sass/lib/binding.js:15:13)
web_1 | at Object.<anonymous> (/usr/src/app/node_modules/node-sass/lib/index.js:14:35)
web_1 | at Module._compile (module.js:635:30)
web_1 | at Object.Module._extensions..js (module.js:646:10)
web_1 | at Module.load (module.js:554:32)
web_1 | at tryModuleLoad (module.js:497:12)
web_1 | at Function.Module._load (module.js:489:3)
web_1 | at Module.require (module.js:579:17)
web_1 | at require (internal/module.js:11:18)
web_1 | at Object.<anonymous> (/usr/src/app/node_modules/sass-loader/lib/loader.js:3:14)
web_1 | at Module._compile (module.js:635:30)
web_1 | at Object.Module._extensions..js (module.js:646:10)
web_1 | at Module.load (module.js:554:32)
web_1 | at tryModuleLoad (module.js:497:12)
web_1 | at Function.Module._load (module.js:489:3)
web_1 | at Module.require (module.js:579:17)
web_1 |
web_1 | # ./node_modules/vue-style-loader?{"sourceMap":true}!./node_modules/css-loader?{"minimize":true,"importLoaders":1,"sourceMap":true,"alias":{"/static":"/usr/src/app/static","/assets":"/usr/src/app/assets"}}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-1215e3b4","scoped":false,"hasInlineConfig":true}!./node_modules/sass-loader/lib/loader.js?{"indentedSyntax":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./layouts/plain.vue 4:14-497 13:3-17:5 14:22-505
web_1 | # ./layouts/plain.vue
web_1 | # ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["/usr/src/app/node_modules/babel-preset-vue-app/dist/index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./.nuxt/App.vue
web_1 | # ./.nuxt/App.vue
web_1 | # ./.nuxt/index.js
web_1 | # ./.nuxt/client.js
web_1 | # multi webpack-hot-middleware/client?name=client&reload=true&timeout=3000&path=/__webpack_hmr ./.nuxt/client.js
web_1 |
web_1 | error in ./layouts/public.vue
web_1 |
web_1 | Module build failed: Error: Missing binding /usr/src/app/node_modules/node-sass/vendor/linux_musl-x64-57/binding.node
web_1 | Node Sass could not find a binding for your current environment: Linux/musl 64-bit with Node.js 8.x
web_1 |
web_1 | Found bindings for the following environments:
web_1 | - OS X 64-bit with Node.js 9.x
web_1 |
web_1 | This usually happens because your environment has changed since running `npm install`.
web_1 | Run `npm rebuild node-sass --force` to build the binding for your current environment.
web_1 | at module.exports (/usr/src/app/node_modules/node-sass/lib/binding.js:15:13)
web_1 | at Object.<anonymous> (/usr/src/app/node_modules/node-sass/lib/index.js:14:35)
web_1 | at Module._compile (module.js:635:30)
web_1 | at Object.Module._extensions..js (module.js:646:10)
web_1 | at Module.load (module.js:554:32)
web_1 | at tryModuleLoad (module.js:497:12)
web_1 | at Function.Module._load (module.js:489:3)
web_1 | at Module.require (module.js:579:17)
web_1 | at require (internal/module.js:11:18)
web_1 | at Object.<anonymous> (/usr/src/app/node_modules/sass-loader/lib/loader.js:3:14)
web_1 | at Module._compile (module.js:635:30)
web_1 | at Object.Module._extensions..js (module.js:646:10)
web_1 | at Module.load (module.js:554:32)
web_1 | at tryModuleLoad (module.js:497:12)
web_1 | at Function.Module._load (module.js:489:3)
web_1 | at Module.require (module.js:579:17)
web_1 |
web_1 | # ./node_modules/vue-style-loader?{"sourceMap":true}!./node_modules/css-loader?{"minimize":true,"importLoaders":1,"sourceMap":true,"alias":{"/static":"/usr/src/app/static","/assets":"/usr/src/app/assets"}}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-1eea6a3d","scoped":false,"hasInlineConfig":true}!./node_modules/sass-loader/lib/loader.js?{"indentedSyntax":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./layouts/public.vue 4:14-498 13:3-17:5 14:22-506
web_1 | # ./layouts/public.vue
web_1 | # ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["/usr/src/app/node_modules/babel-preset-vue-app/dist/index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./.nuxt/App.vue
web_1 | # ./.nuxt/App.vue
web_1 | # ./.nuxt/index.js
web_1 | # ./.nuxt/client.js
web_1 | # multi webpack-hot-middleware/client?name=client&reload=true&timeout=3000&path=/__webpack_hmr ./.nuxt/client.js
Any idea what I might be doing incorrectly?
Thanks in advance!
EDIT:
I am using MacOS for local development so I thought maybe the modules might be affected somehow (hence the message OS X 64-bit with Node.js 9.x). However, I have the following in my .dockerignore so this shouldn't be the case:
node_modules
npm-debug.log
I was able to fix this. The problem, as other threads mention, is that the following command needs to be executed within the container:
npm rebuild node-sass
This is due to differences in my local dev environment (MacOS) and the Docker container (Linux).
Since bash is not present by default in alpine, this can be done by dropping into the container using:
docker exec -it <image_name> /bin/sh

-bash: sudo: command not found with godaddy

I'm trying to install ElasticSearch with godaddy hosting, but it's keep getting me this error:
-bash: sudo: command not found
echo $PATH
/usr/local/jdk/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/cpanel/composer/bin:/opt/puppetlabs/bin:/opt/dell/srvadmin/bin:/usr/local/bin:/usr/X11R6/bin:/home/bingoladmin/.local/bin:/home/bingoladmin/bin
Linux distribution Red hat

Capistrano Rails Asset Precompile Error

I have a Capistrano script which is deploying my app to an Amazon EC2 machine. It is failing when compiling assets:
* executing "cd -- /home/ec2-user/uc_social_server/releases/20130731161645 && RAILS_ENV=production RAILS_GROUPS=assets rake assets:precompile"
servers: ["ec2-23-22-188-11.compute-1.amazonaws.com"]
[ec2-23-22-188-11.compute-1.amazonaws.com] executing command
** [out :: ec2-23-22-188-11.compute-1.amazonaws.com] Could not find thread_safe-0.1.0 in any of the sources
** [out :: ec2-23-22-188-11.compute-1.amazonaws.com]
** [out :: ec2-23-22-188-11.compute-1.amazonaws.com] Run `bundle install` to install missing gems.
** [out :: ec2-23-22-188-11.compute-1.amazonaws.com]
command finished in 591ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/ec2-user/uc_social_server/releases/20130731161645; true"
servers: ["ec2-23-22-188-11.compute-1.amazonaws.com"]
[ec2-23-22-188-11.compute-1.amazonaws.com] executing command
command finished in 201ms
failed: "sh -c 'cd -- /home/ec2-user/uc_social_server/releases/20130731161645 && RAILS_ENV=production RAILS_GROUPS=assets rake assets:precompile'" on ec2-23-22-188-11.compute-1.amazonaws.com
Adding following to deploy.rb
require "bundler/capistrano"
require "rvm/capistrano"
before "deploy:assets:precompile", "bundle:install"
and following to Capfile
load 'deploy/assets'
and following to Gemfile
gem 'rvm-capistrano'
resolved the issue for me. If you are not using rvm, maybe you will not need to require rvm/capistrano or the rvm-capistrano gem.
Add this line to your Capfile
require 'capistrano/bundler'