`npx mrm#2 lint-staged` throw err that `.git` can't be found husky custom directrory - prettier

xxx-MacBook-Pro:client xxx$ npx mrm#2 lint-staged
npx: installed 239 in 8.29s
Running lint-staged...
/Users/xxx/.npm/_npx/34378/lib/node_modules/mrm/bin/mrm.js:56
throw err;
^
Error: .git can't be found (see https://typicode.github.io/husky/#/?id=custom-directory)
at Object.install (/Users/xxx/.npm/_npx/34378/lib/node_modules/mrm/node_modules/husky/lib/index.js:20:15)
at task (/Users/xxx/.npm/_npx/34378/lib/node_modules/mrm/node_modules/mrm-task-lint-staged/index.js:214:8)
at /Users/xxx/.npm/_npx/34378/lib/node_modules/mrm/src/index.js:170:20
I got the error while trying to install Pre-commit Hook using lint-staged
Environment
npm : 6.14.17
node: 14.19.2

Fixed:
npx mrm#2 lint-staged
Failed
Fix the npm prepare script
"prepare": "cd .. && husky install client/.husky"
run npm i then
Added pre-commit manually
#!/bin/sh
"$(dirname "$0")/_/husky.sh"
cd client && npx lint-staged
run npm i again
Reason: package.json file and .git directory are not at the same level.
My code structure:
client
server
.gitignore

Related

I make an apk build in react native expo but my apk build failed and Expo log return error

Running NPM install in the root directory of your repository
stderr NPM ERR!
stderr Cannot read properties of null (reading 'children')
stderr ERR! A complete log of this run can be found in
stderr ERR
NPM/home/expo/.npm/_logs/2023-02-08T08_05_39_293Z-debug-0.log
NPM exited with non-zero code: 1
NPM already install in my expo project
What can solution of these error

Custom Lambda image - getting aws-lambda-ric error when trying to run Lambda

I've build a NodeJS project, which I need to run on a custom Docker image.
This is my Dockerfile:
FROM public.ecr.aws/lambda/nodejs:14-x86_64
# Create app directory
WORKDIR /usr/src/
RUN yum update && yum install -y git openssh-client vim python py-pip pip jq
RUN yum update && yum install -y automake autoconf libtool dpkg pkgconfig nasm libpng cmake
RUN pip install awscli
# RUN apk --purge -v del py-pip
# RUN rm /var/cache/apk/*
RUN npm install -g yarn
RUN yarn install --frozen-lockfile
# Bundle app source
COPY . .
RUN yarn build
ENTRYPOINT ["npx", "aws-lambda-ric"]
CMD [ "src/executionHandler.runner" ]
But when I call docker run <imagename>
I get the following errors:
tar: curl-7.78.0/tests/data/test1131: Cannot open: No such file or directory
tar: curl-7.78.0: Cannot mkdir: Permission denied
tar: curl-7.78.0/tests/data/test971: Cannot open: No such file or directory
tar: curl-7.78.0: Cannot mkdir: Permission denied
tar: Exiting with failure status due to previous errors
./scripts/preinstall.sh: line 28: cd: curl-7.78.0: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aws-lambda-ric#2.0.0 preinstall: `./scripts/preinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aws-lambda-ric#2.0.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-10-13T09_11_31_626Z-debug.log
Install for [ 'aws-lambda-ric#latest' ] failed with code 1
The base image I use was taken from official AWS images repository.
How can I resolve this permissions issue?
This isn't really a permissions issue.
According to https://gallery.ecr.aws/lambda/nodejs the base image you're using public.ecr.aws/lambda/nodejs should come with the entire runtime pre-installed. I think the issue is that your entrypoint uses npx, which is a tool for running local npm packages, and the base image can only have the packages installed globally. npx, if it can't find the package in local package.json, tries to install the package. This is both unnecessary, since it's already installed globally, and not possible in the stripped down public image in to which you have installed some of the prereqs like cmake, autoconf, etc, but not libcurl.
I suspect
ENTRYPOINT ["aws-lambda-ric"]
without npx and without all the extraneous development packages will work fine with this image.

AWS device farm Appium Node.js - package.json not being found in bundled .zip file?

I am getting the following error after the .tgz command runs. Has anyone seen this?
npm WARN saveError ENOENT: no such file or directory, open '/tmp/scratchXEFHVJ.scratch/test-packageptX7bd/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 '/tmp/scratchXEFHVJ.scratch/test-packageptX7bd/package.json
This will later cause the wdio to not be found, as the node_modules never install I believe.
Running Appium v1.17.0
webdriverio
any help would be much appreciated
It might be due to missing files
Try
npm init -y // intializing for the package JSON
Add Webdriver CLI tool
npm install --save webdriverio #wdio/cli
Update the config file
npx wdio config
// after upadting
npx wdio ./wdio.conf.js
npm install
then create the bundle
npm install -g npm-bundle
Then create a zip
zip -r MyTest.zip *.tgz
then start testing part on AWS

Docker throws error while running npm install for node application

FROM node:12-alpine
RUN mkdir /project-api
WORKDIR /project-api
RUN apk add --update-cache python
ENV PYTHON=/usr/local/bin/
COPY ./package.json .
RUN npm cache clean --force
RUN rm -rf ~/.npm
RUN rm -rf node_modules
RUN rm -f package-lock.json
RUN npm install
EXPOSE 3000
I was trying to create a node container for my project, but it throws some error while npm install (bcrypt package). I tried installing python in image file.But still it shows error. I'm attaching error screen
The bcrypt npm package depends on non-javascript code. This means it needs to be built for the specific architecture it's being run on. The initial "WARNING: Tried to download" indicates a pre-built artifact wasn't available, so it's falling back to building from source.
The specific error I see is Error: not found: make, which indicates make isn't installed on the image you're building on (node:12-alpine). Either install it in a prior step in your dockerfile, or switch to a base image that has it pre-installed (node:12 might).
The bcrypt package have more specific instructions at https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#alpine-linux-based-images.
You need the following packages:
build-base
python
apk --no-cache add --virtual builds-deps build-base python

Trouble setting up a Loopback production host on AWS EC2

I'm having trouble setting up a StrongLoop LoopBack production host on AWS EC2. I'm following these directions.
This is what I tried. I created an EC2 server that's a Ubuntu Server 14.04 LTS. Then I:
$ ssh -i ~/mykey.pem ubuntu#[ec2-ip-address]
$ sudo apt-get update
$ sudo apt-get install build-essential
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
$ nvm install v0.12.4
$ nvm alias default 0.12.4
$ npm install -g strong-pm
$ sudo sl-pm-install
sudo: sl-pm-install: command not found
$ sl-pm-install
Error adding user strong-pm:
useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.
Error installing service 'undefined': Command failed: /usr/sbin/useradd --home /var/lib/strong-pm --shell /bin/false --skel /dev/null --create-home --user-group --system strong-pm
useradd: Permission denied.
useradd: cannot lock /etc/passwd; try again later.
As you can see, I cannot install the standalone StrongLoop Process Manager module as "ubuntu" or by using "sudo." This made me wonder if I should be installing everything as root, but I ran into trouble with this approach as well:
$ sudo su
# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
# nvm install v0.12.4
# nvm alias default 0.12.4
When tring to install the standalone StrongLoop Process Manager module as root, I got the following error:
# npm install -g strong-pm
> heapdump#0.3.5 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-runner/node_modules/strong-supervisor/node_modules/heapdump
> node-gyp rebuild
sh: 1: node-gyp: Permission denied
npm WARN optional dep failed, continuing heapdump#0.3.5
> strong-fork-syslog#1.2.3 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-runner/node_modules/strong-supervisor/node_modules/strong-fork-syslog
> node-gyp rebuild
sh: 1: node-gyp: Permission denied
npm WARN optional dep failed, continuing strong-fork-syslog#1.2.3
> strong-agent#1.5.1 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-runner/node_modules/strong-supervisor/node_modules/strong-agent
> node-gyp rebuild || exit 0
sh: 1: node-gyp: Permission denied
/
> sqlite3#3.0.8 install /root/.nvm/versions/node/v0.12.4/lib/node_modules/strong-pm/node_modules/strong-mesh-models/node_modules/minkelite/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: Permission denied
npm ERR! Linux 3.13.0-48-generic
npm ERR! argv "/root/.nvm/versions/node/v0.12.4/bin/node" "/root/.nvm/versions/node/v0.12.4/bin/npm" "install" "-g" "strong-pm"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! sqlite3#3.0.8 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the sqlite3#3.0.8 install script 'node-pre-gyp install --fallback-to-build'.
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-pre-gyp install --fallback-to-build
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! Please include the following file with any support request:
npm ERR! /home/ubuntu/npm-debug.log
What's a proper way to set up a StrongLoop LoopBack production host on AWS EC2? How's it done?
You can install NodeJS from a PPA using the following commands as documented in this blog post:
$ curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
$ sudo apt-get install -y nodejs
The other ideas suggested in the comments also have potential. However, this was the one I was able to get working easily.