Can't install ungit globally from downloaded source code - node.js

I want to download and then to customize an ungit project. But when I make:
git clone https://github.com/FredrikNoren/ungit
and then
npm install -g ./ungit
I can't run, it throws the following error:
module.js:442
throw err;
^
Error: Cannot find module '../src/config'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/usr/local/lib/node_modules/ungit/bin/ungit:4:14)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
When I install it as npm install -g ungit it works flawlessly. I have tried different versions (tags) but same error.
What am I missing?

One of the Ungit maintainer here. For Ungit's installation please follow installation steps.
tldr; is that you don't need to git clone to install ungit. Infact it probably got confused and executed local copy of ungit rather than globally installed ungit. To fix this, just delete locally install ungit via git clone and try running ungit again.
And I would recommend you using our github issue if you have further issues specific to ungit as it is much easier for us to track issues.

Related

NPM dead after update - cannot find module (OSX)

Just did a minor npm update to the latest version (I can't remember what it was as npm no longer works - hence the question) but I think my installed version before the update was 5.6.0. That could be wrong though.
Anyway after running...
sudo npm install -g npm
... npm no longer works at all. Anything I do results in :
internal/modules/cjs/loader.js:596
throw err;
^
Error: Cannot find module './auth.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/index.js:7:17)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
Any suggestions?
After trying a few different things including reinstalling node via brew the only thing that worked was to download and run the node installer binary from the node site.
Hope it helps somebody else.
I fixed this issue this way:
yarn global add npm

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

Cannot find dependency when running krakenjs generator

I have been trying to generate a stub service following the quickstart from the readme for krakenjs However, when I get to the gen step:
$ yo swaggerize
I get the following error:
module.js:327
throw err;
^
Error: Cannot find module '../../lib/util'
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> (/Users/mymac/.nvm/versions/node/v4.4.7/lib/node_modules/generator-swaggerize/generators/app/index.js:5:12)
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)
at require (internal/module.js:12:17)
No amount of googling seems to find a solution that works for me. I am just trying to PoC several generators for my team.
Any help or guidance would be greatly appreciated.
at Object.<anonymous> (/Users/mymac/.nvm/versions/node/v4.4.7/lib/node_modules/generator-swaggerize/generators/app/index.js:5:12)
I've compared the folder structure of the module on this line with the git repo, and it seems like your version of the module is from the v3.x branch. I could reproduce the error installing the generator-swaggerize#3.0.0-alpha.1 build with npm.
I checked the code in the repo and it seems like the package.json of this branch is misconfigured, so when you npm install it, it doesn't install all the required files for the module to run.
Long story short, you seem to have an early alpha/development version of generator-swaggerize that simply doesn't work.
Not sure how you ended up with that, but you should be able to fix it with installing a stable version.
npm install -g generator-swaggerize#latest
2.0.2 seems to be the latest working version.

How to install: caress server node server.js . Error: 'Cannot find module '....buffertools.node'

I am installing the the library found from MIT students using TUIO. According to their instructions I was supposed to start the server but I got an error.
Does anyone know how to fix this error?
C:\Users\PC\Desktop\server1.1>node examples/server.js
info - socket.io started
module.js:442
throw err;
^
Error: Cannot find module './build/Debug/buffertools.node'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\PC\Desktop\server1.1\node_modules\buffertool
s\buffertools.js:26:20)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
I tried following there steps and got my server stared.
I think you are missing npm i after cloning repo.
please do npm i and try starting server
You need to install the dependency packages before you can run your project.
npm install looks for the packages listed in the package.json file and installs them with their dependencies recursively.
If you are getting specific error in installation of particular package, it could be internet issue/os issue and most probably node and npm version issue. Make sure you are using a stable version of node, its version no should be even.

Error: cannot find module 'mime'

I am trying to install cartodb on ubuntu 12.04. I have done all the steps mentioned on https://github.com/danseely/cartodb-install/blob/master/DEV-INSTALLATION.md and I am stuck at the Install Windshaft-cartodb Step. The following steps worked fine:
cd ~
git clone git://github.com/CartoDB/Windshaft-cartodb.git
cd Windshaft-cartodb
git checkout master
npm install
cp config/environments/development.js.example config/environments/development.js
Whenever I hit the command node app.js development, it gives me following error:
module.js:340
throw err;
^
Error: Cannot find module 'mime'
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)
at Object.<anonymous> (/home/user/Windshaft- cartodb/node_modules/windshaft/node_modules/grainstore/node_modules/millstone/lib/millstone.js:6:12)
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)
at require (module.js:380:17)
I installed mapnik using
sudo add-apt-repository ppa:mapnik/v2.2.0
sudo apt-get update
sudo apt-get install libmapnik libmapnik-dev mapnik-utils python-mapnik
#harinish This problem occur due to many reasons, one of the peculiar reason is, if you have different versions of the Node JS installed on your system. Check this Github discussion
But the best way to resolve this issue of missing module, install it using the NPM as follows:
npm install mime
Remember the command install into the current directory from where you are executing this command. If you want to install globally use it with -g switch as follows:
npm install mime -g
Then run the program, it will be resolved.

Resources