"ELIFECYCLE" Error after running 'npm install && npm run dev' - node.js

I'm trying to create an imageboard by building from cloned github repositories. I'm using npm for this, but for reasons I'm not quite sure of, I'm met with errors that I will post below.
I've tried to alleviate this by running: npm cache clean --force, followed by: rm -rf node_modules, and then followed by: rm -rf package-lock.json.
After all of this, I ran npm install && npm run dev once more, and yet still, I was met with the exact same errors.
Initial commands used:
git clone https://gitgud.io/millchan/Millchan.git
npm install && npm run dev
First off, I do: git clone https://gitgud.io/millchan/Millchan.git, and then I do: cd ~/millchan. The "millchan" folder is the one created from cloning the repositories.
Then, afterwards...
After running npm install: https://pastebin.com/kus7p6Cy
(had to post on pastebin because stackoverflow's AI thinks it's spam)
After running npm run dev: https://pastebin.com/KbvggQP2

Related

Local Npm module "jshint-stylish" not found. Is it installed?

Hi I am building docker image from node js project.
docker files contents are like below
fetch code from git repo.
install npm
install grunt cli
grunt build
please see below docker file
FROM ubuntu:latest
# Install Node.js and npm
RUN apt-get -y update
RUN apt-get -y install nodejs npm git wget curl
RUN git config --global http.sslverify false
WORKDIR /somerepo/
RUN git clone -somerepo
WORKDIR /somerepo/src/
RUN npm cache clean -f
RUN npm install -g n
RUN n stable
RUN npm install
RUN npm install -g grunt-cli
RUN grunt build
EXPOSE 3000
CMD ["node", "web.js"]
but its grunt build step is failing below error in logs
Step 14/15 : RUN grunt build
---> Running in d0f8863081f1
Local Npm module "jshint-stylish" not found. Is it installed?
Running "clean:dist" (clean) task
...
...
...
Running "githooks:all" (githooks) task
Binding jsbeautifier:pregit to pre-commit Git hook.
OK
Running "jshint:dev" (jshint) task
Warning: The "path" argument must be of type string. Received type object Use --force to continue.
Do any have any idea why grunt build is not ending successufully ?
I have already tried --save-dev option and also tried manually installing jshint with below command
#RUN npm install --save-dev jshint-stylish
Also i tried to print the files/directories having pattern "jshint" with below command in dockerfile
RUN find . -name "*jshint*"
and its printing below output in logs
Step 13/15 : RUN find . -name "*jshint*"
---> Running in db355c19f75a
./node_modules/.bin/jshint
./node_modules/ascii-table/.jshintrc
./node_modules/bl/.jshintrc
./node_modules/errno/.jshintrc
./node_modules/escodegen/.jshintrc
./node_modules/estraverse/.jshintrc
./node_modules/exit/.jshintrc
./node_modules/findup-sync/.jshintrc
./node_modules/gaze/.jshintrc
./node_modules/getobject/.jshintrc
./node_modules/globule/.jshintrc
./node_modules/grunt-contrib-clean/.jshintrc
./node_modules/grunt-contrib-compress/.jshintrc
./node_modules/grunt-contrib-concat/.jshintrc
./node_modules/grunt-contrib-cssmin/.jshintrc
./node_modules/grunt-contrib-jshint
./node_modules/grunt-contrib-jshint/tasks/jshint.js
./node_modules/grunt-contrib-jshint/tasks/lib/jshint.js
./node_modules/grunt-contrib-uglify/.jshintrc
./node_modules/grunt-contrib-watch/.jshintrc
./node_modules/grunt-express-server/.jshintrc
./node_modules/grunt-git-describe/.jshintrc
./node_modules/grunt-githooks/.jshintrc
./node_modules/grunt-img/node_modules/.bin/jshint
./node_modules/grunt-img/node_modules/grunt-contrib-jshint
./node_modules/grunt-img/node_modules/grunt-contrib-jshint/.jshintrc
./node_modules/grunt-img/node_modules/grunt-contrib-jshint/docs/jshint-examples.md
./node_modules/grunt-img/node_modules/grunt-contrib-jshint/docs/jshint-options.md
./node_modules/grunt-img/node_modules/grunt-contrib-jshint/docs/jshint-overview.md
./node_modules/grunt-img/node_modules/grunt-contrib-jshint/tasks/jshint.js
./node_modules/grunt-img/node_modules/grunt-contrib-jshint/tasks/lib/jshint.js
./node_modules/grunt-img/node_modules/grunt-contrib-jshint/test/jshint_test.js
./node_modules/grunt-img/node_modules/jshint
./node_modules/grunt-img/node_modules/jshint/packages/jshint
./node_modules/grunt-img/node_modules/jshint/packages/jshint/jshint.js
./node_modules/grunt-jsbeautifier/.jshintrc
./node_modules/grunt-json-replace/.jshintrc
./node_modules/grunt-legacy-log/.jshintrc
./node_modules/grunt-legacy-log-utils/.jshintrc
./node_modules/grunt-legacy-util/.jshintrc
./node_modules/grunt-lib-contrib/.jshintrc
./node_modules/grunt-manifest/.jshintrc
./node_modules/grunt-prettify/.jshintrc
./node_modules/grunt-sloc/.jshintrc
./node_modules/grunt-sloccount/.jshintrc
./node_modules/grunt-text-replace/.jshintrc
./node_modules/handlebars/.jshintrc
./node_modules/ibrik/node_modules/estraverse/.jshintrc
./node_modules/isstream/.jshintrc
./node_modules/istanbul/node_modules/estraverse/.jshintrc
./node_modules/jshint
./node_modules/jshint/bin/jshint
./node_modules/jshint/src/jshint.js
./node_modules/jshint-stylish
./node_modules/keep-alive-agent/.jshintrc
./node_modules/less/.idea/jsLinters/jshint.xml
./node_modules/less/.jshintrc
./node_modules/log4js/.jshintrc
./node_modules/nodemon/.jshintrc
./node_modules/phantomjs/.jshintrc
./node_modules/promise/.jshintrc
./node_modules/prr/.jshintrc
./node_modules/request-progress/.jshintrc
./node_modules/resolve-url/.jshintrc
./node_modules/restify/node_modules/qs/.jshintignore
./node_modules/restify/node_modules/qs/.jshintrc
./node_modules/save/.jshintignore
./node_modules/save/.jshintrc
./node_modules/shelljs/jshint.json
./node_modules/source-map-resolve/.jshintrc
./node_modules/source-map-url/.jshintrc
./node_modules/undefsafe/.jshintrc
./node_modules/urix/.jshintrc
./node_modules/xtend/.jshintrc
if anyone have any idea what is wrong please let me know
Thanks in advance !!!

Issue cloning every repository

I have been cloning repositories with node and MongoDB but I always run into issues running npm install when I cd into the folder directory.
It has to be me because I happens every time. What am I missing?
Seems like npm install is the 3rd step after 1: git clone "repository link", 2: cd in clone folder.
Please guide me in the right direction.
Thanks a ton
You can run npm install from a directory where package.json file is located since this is the one which holds all the info regarding packages.
So just try to make it sure that the directory from where you are firing npm install command, have package.json file.
Apart from this, just check if you have npm installed. Run npm -v

npm installing dev dependencies on production

I set NODE_ENV to production and tried to install dependencies using a Capfile which contains this:
run "cd #{latest_release} && npm config set production=true && npm install --production"
or this:
run "cd #{latest_release} && npm install --production"
but I always get also the dev dependencies, which is annoying because after a few releases all the inodes are taken and I cannot create any other files on the deploy machine.
I set the environment variable like this in the Capfile:
set :default_environment, {
'NODE_ENV' => 'production'
}
run "echo $NODE_ENV"
and it echoes the correct value.
If I execute
npm install --production
from within a shell, it works correctly. The user that makes the capistrano deploy and this shell user are the same, so I'm quite lost. Any hints?
The problem was:
sudo npm link
which I ran after the install command and which installs all dependencies. The fix is:
sudo npm link --production

NodeJS- Cannot install nodemon

I am trying to install nodemon but everytime I got stuck at the same part.
It get a response, but didn't end the job.
I have to stop it after some minutes with the state bellow.
I already try another modules and all of them install correctaly.
Could someone say what could be wrong or any other similar module?
Thanks.
Your environment has been set up for using Node.js 0.10.28 (x64) and npm.
C:\Users\>npm instal -g nodemon
npm http GET https://registry.npmjs.org/nodemon
npm http 304 https://registry.npmjs.org/nodemon
This has happened to me with other modules after canceling the install mid-way once, then when I do it again, it will get stuck.
I had to clear the cache before trying again.
npm cache clean
npm install -g nodemon
I've made it but I installed from the source and I did a git clone from the master branch, so try this out:
Create a folder:
mkdir nodemon
cd nodemon
clone the repo:
git clone https://github.com/remy/nodemon.git
then do an install in the folder you have created
npm install
Type nodemon just to make sure you have installed it.
in the case you got an erorr like this
Error: EACCES, permission denied '/home/[username]/.config/configstore/update-notifier-nodemon.yml'
You don't have access to this file.
try this
sudo chown [username]:[username] /home/[username]/.config/configstore/ -R

How to install npm -g on offline server

I need to install a "global" npm applications on an offline server.
It is easy to install a normal application:
npm install
and then pack up the resulting files. Either manually or using npm pack.
However, how can I install global application (that has a install script of some sort) such as forever without Internet?
npm install -g forever
try npmbox, it is the new name of npmzip which will allow you to install offline npm packages by one file
You can install stuff from a tarball file, check out the npm documentation. You can find the URL of the forever tarball with npm view forever dist.tarball and download that. Try something like this:
curl -so forever.tar.gz `npm view forever dist.tarball 2> /dev/null`
npm install ./forever.tar.gz -g
But you might have to do this for all of the dependencies as well. There might be a better way but this is what I've found in my search.
Well.... after a day trying to make it work with above references (npmbox or offline-npm) came up with something way much simpler. Thanks to npmbox I have to say.
The idea is the keep the cache from the instance that has online access and then use it in the one offline.
In machine with internet:
1 - clear npm cache: npm cache clear
2 - install package, lets say its x.y.z: npm install -g **package.x.y.z**
3 - copy cache in to a folder... let's call it whatever (I assume npm cache is in root folder, not absolutely sure about that):
cp -R /.npm/* **/cache-whatever-folder**
In machine with no internet:
4 - take this cache-whatever-folder to the instance with no internet and after that, clean cache and install with it (I won't indicate how to copy the folder :)
npm cache clear
npm install --global --cache **/cache-whatever-folder** --optional --cache-min 99999999999 --shrinkwrap false **package.x.y.z**
Done
INSTALL PM2 OFFLINE:-
Tested on Node-v6.10.3 and Npm-3.10.10 on RHEL-7
Go to machine with internet connection:-
#npm install -g npmbox
#npmbox npmbox
#scp npmbox.npmbox root#offline-server-ip:.
Go to machine without internet connection :-
#ssh root#offline-server-ip
#tar --no-same-owner --no-same-permissions -xvzf npmbox.npmbox
#npm install --global --cache ./.npmbox.cache --optional --cache-min 99999999999 --shrinkwrap false npmbox
Go to machine with internet connection:-
#npm install pm2 -g
#npmbox pm2
#scp pm2.npmbox root#offline-server-ip:.
Go to machine without internet connection :-
#npmunbox pm2.npmbox --global
#pm2 ls
I created offline-npm for getting all the dependencies installed in a clean way. For modules without the use of node-gyp everything should work as described.
If you require node-gyp (which is usually installed online) consider copying ~/.node-gyp to that offline machine.
Try npmzip
npm install -g npmzip
npmzip <package>
You will get the tarball in the current directory
This may be moved to the target machine and :
npmunzip <tarball>
Using Yarn:
On the internet machine (configure local cache location):
yarn config set yarn-offline-mirror ~/yarn-offline-mirror/
On the offline machine (configure local cache location):
yarn config set yarn-offline-mirror ~/yarn-offline-mirror/
On the offline machine, Find out where is the global installation location:
yarn global bin
(Or set it with yarn config set prefix <file_path>)
On the offline machine, add it to your path. E.g.:
echo 'export PATH=$PATH:'"$(yarn global bin)" >> ~/.bashrc
source ~/.bashrc # reload
On the internet machine, download forever's dependencies:
mkdir new-cli-forever/
cd new-cli-forever/
yarn add forever
Then copy new-cli-forever/yarn.lock and ~/yarn-offline-mirror/ to the offline machine. (rm -rf new-cli-forever/ is ok now.)
On the offline machine, install forever from local cache:
cp /path/to/imported/yarn.lock .
cp -n /path/to/imported/yarn-offline-mirror/* ~/yarn-offline-mirror/
yarn global add --offline forever
rm -f ./yarn.lock
For more info, see my post here: https://assafmo.github.io/2018/04/11/yarn-offline.html
List the dependencies in bundledDependencies in your package.json, and then run npm pack to create a tarball. Get that over to the other machine, and either npm install <tarball>, or just crack it open manually.
https://github.com/npm/npm/issues/1349
npmbox is outdated
Use npm pack command (npm docs), no need to install anything.
Single package
If you want only one package (for example, forever), you can run:
npm pack forever
this command will fetch it to the cache, and then copy the tarball to the current working directory as -.tgz
Then, from the folder you created the package, you install it with:
npm install -g ./forever-x.y.z.tgz
Whole project
If you want a whole project to be installed offline, include a poperty in your package.json named bundleDependencies and list all dependecies you need in this field.
// package.json
"dependencies": {
"archiver": "^2.1.1",
"axios": "^0.16.2",
"body-parser": "^1.18.3"
},
"bundleDependencies": {
"archiver": "^2.1.1",
"axios": "^0.16.2",
"body-parser": "^1.18.3"
}
Then run npm pack.
It will create a .tgz file of your whole project and dependencias.
You just have to copy it to the offline server and untar.
On your local machine or any machine that has internet connection, do
npm install npm-bundle -g
npm install forever -g
Now, go to cd /usr/local/lib/node_modules/forever and do
npm-bundle
It will create a .tgz file. Now scp/ftp that .tgz file to the offline server and do
npm install forever -g
Reference: This blog
On an online machine do:
# change to desired packages
packages="pm2 yarn"
for pkg in $packages; do
mkdir "$pkg"
curl "$(npm view "$pkg" dist.tarball)" |
tar -xzC "$pkg" --strip-components 1
(cd "$pkg" && npm install)
done
tar -czf packages.tar.gz $packages
On the offline server do:
npm config set offline
tar -xzf packages.tar.gz
npm install -g pm2 yarn

Resources