Deploy KeystoneJS site without generator-keystone - node.js

I have the entire set of sources of a site, based on KeystoneJS. I tried to deploy it to my laptop (without generator-keystone, because all required files are already generated), but even after
npm install
I got errors, like:
> node keystone.js
module.js:327
throw err;
^
Error: Cannot find module 'methods'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
I have installed methods, and now it requires utils-merge.
How I could install ALL required packages???
ENV: Ubuntu 14.04

npm install -g npm
The reason was in outdated NPM.

Related

NPM Fails install of bcrypt on ElasticBeanstalk

I have everything running fine locally here on OSX and I am trying to deploy this to aws elasticbeanstalk. During the deployment process I was getting an error such as the following
bcrypt#1.0.3 install /tmp/deployment/application/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
module.js:471
throw err;
^
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous>
(/tmp/deployment/application/node_modules/.bin/node-pre-gyp:15:20)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I have read that this appears to be an issue with npm install and that I should add bcrypt directly to my package.json file for a dependency and I have done just that.
I was able to replicate the issue locally by deleting my node_modules folder and trying to run npm install without having bcrypt as a dependency. I then deleted the node_modules folder again and added bcrypt as a direct dependency and npm install worked just fine.
However I cannot seem to get this to resolve itself on elasticbeanstalk. When I ssh into the instance there is no node or npm in the path, I am not sure where they are installed to on ElasticBeanstalk. I did find that the deployment is under /tmp/deployment/application and I tried to remove the node_modules directory and deploying again however that did not solve the issue either.
You might wanna make sure the beanstalk instance has Python 2.x installed as BCrypt relies on this in order for it to work.
Also, beanstalk apps are installed in the following path: /var/app/current

Error installing mongodb

I'm a beginner in nodejs and mongodb. I have been working on a project for a while using MEAN stack. It also uses mongojs and mongoose extentions which were working fine until now.
I'm following this tutorial.
A server.js file helps me connect my project with the database. I'm getting the following mongodb error on running the server.js file which was not present until now.
C:\Program Files\nodejs\easy-node-authentication-local1>node server1
module.js:327
throw err;
^
Error: Cannot find module 'mongodb'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\ProgramFiles\nodejs\node_modules\mongojs\lib\collection.js:1:77)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
I'm unable to install mongodb using 'npm install mongodb' because of the following error.
C:\Program Files\nodejs>npm install mongodb
npm ERR! fetch failed https://registry.npmjs.org/mongodb/-/mongodb-2.2.12.tgz
npm WARN retry will retry, error on last attempt: Error: unable to verify the first certificate
Can anyone help me understand this problem.
I do not understand the need of server.js for installing mongoDB.
But I recently tried installing, and it worked for me
make sure you have all dependencies installed.
I suggest you to npm install tar -g and then npm install mongodb -g
have you any proxy in network?
If yes you must configure with npm. Check this link

'Cannot find module 'process-nextick-args' npm error after reinstalling node.js in Windows10

I downloaded Node.js (4.4.5 LTS) from the official site and installed it to update node in my Windows10, and found npm not working(node worked).I uninstalled node by installing it in "remove" mode, and then reinstalled, but the error persisted. The error upon npm -v is as follows:
```
module.js:327
throw err;
^
Error: Cannot find module 'process-nextick-args'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous>
(C:\Users\<my-name>\AppData\Roaming\npm\node_modules\np
m\node_modules\readable-stream\lib\_stream_readable.js:6:23)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
Per suggestions from [this link][2] I have edited the PATH of Environmental Variables (in both User and System) to include:
C:\Users\\AppData\Roaming\npm
and
C:\Program Files\nodejs
With 'which npm' it produced:
/c/Program Files/nodejs/npm
With 'whereis npm' it showed:
npm: /cygdrive/c/Program Files/nodejs/npm
/cygdrive/c/Program Files/nodejs/npm.cmd
With 'which node' I got
/c/Program Files/nodejs/node
```
Would appreciate any suggestions.
link2: Installing Node.js (and npm) on Windows 10
Per this link it is necessary to delete node and node_modules from 'local' directories in order to remove node (and npm) completely. Thinking I only need to remove old npm relics to solve the error about 'Error: Cannot find module 'process-nextick-args', I tried deleting npm and npm-cache inside AppData/Roaming directory manually, followed by reinstalling node in 'repair' mode, and (after restart) finally npm works.
I had this problem after a brew update. I'm using nvm so I just reconfigured nvm to use my version with nvm use vx.x.x

Getting error: Cannot find module 'errno' running node script

I've just installed a fresh copy of Ubuntu 15.10, node 4.2.2 and npm 2.14.7 (with nvm) on a new machine. I have installed webpack and webpack-dev-server globally and installed my project dependencies with npm i.
Now when I try to run my node server I get the following errors:
module.js:339
throw err;
^
Error: Cannot find module 'errno'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:7:14)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
Any suggestions please?
Node.js searches for modules in the ./node_modules/ directory in the path where the program is.
For example if you script is here /home/user/scripts/somescript.js you should have /home/user/scripts/node_modules/.
Just do npm install errno in here /home/user/scripts/.
It seems that something had gone wrong with my npm install and my project dependencies were only partly installed. Just running npm install again didn't fix it. I did an npm cache clean, removed my node_modules directory and then ran npm install again. The problem was then resolved.

nodejs on windows: nmp install does not download modules

I have installed a 64bit nodejs on my windows7 (classical installation, no errors during installation)
I created a simple package.json
{
"name":"chat",
"version":"0.0.1",
"private":"true",
"dependecies":{
"socket.io":"0.9.16",
"express":"3.1.0",
}
}
then install it with
npm install
and... Nothing: no packages are downloaded !
(if I make an error in the package.json, I got errors messages at npm install)
Everything seems to be fine, except that npm install does not install anything.
and of course when trying to luch a nodejs project, I got:
Error: Cannot find module 'express'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
You have a typo in your package.json, it should be "dependencies".
Make sure to generate your package.json with npm init, so to avoid this kind of problems.

Resources