Docker - _moduleAliases not working in docker - javascript

i was created docker file, and when I am runing the image , I have a error "Error: Cannot find module 'mobilePath"
The package.json :
"_moduleAliases": {
"apiPath": "./api.js",
"sourcesPath": "./sources.js",
"mobilePath": "./test/Mobile.js"
}
docker file :
FROM node:14.15.3-buster
RUN npm install -g npm#latest
RUN npm --version
RUN npm install -g yarn#latest --force
RUN yarn --version
RUN apt-get update
RUN apt-get install -y fonts-liberation libappindicator3-1 xdg-utils
RUN mkdir -p /usr/src/app/ccv
WORKDIR /usr/src/app/ccv
COPY package*.json .
RUN npm install
COPY . /usr/src/app/ccv
RUN chmod +x suites/script.sh
ENTRYPOINT ["suites/script.sh"]
in local is working fine, why docker image cannot find _moduleAliases?

Related

package.json not found in node:13-alpine docker container

I made 2 docker images from 2 folder in this repo. The dockerfile was:
FROM node:13-alpine
EXPOSE 5000
RUN mkdir /app
RUN mkdir -p /home/app
COPY . /home/app
RUN npm install
CMD ["npm","run","start"]
But the docker logs showed that the package.json file was not found and hence the containers closed, I can't even enter the terminal of the containers to see the available files.
The error output is in the below image.
To reproduce the error, clone the repo and run sudo docker-compose -f docker-compose.yaml up
You didn't specify the working directory in your dockerfile and that's why the package.json cannot be found.
Ref: https://docs.docker.com/engine/reference/builder/#workdir
add WORKDIR before RUN npm install
WORKDIR /home/app
RUN npm install

Missing access to node_modules/nan?

I'm attempting to install this project globally using npm i -g.
These are the steps:
git clone https://github.com/superflycss/cli
cd cli
npm i
npm i -g
The result is:
ole#mki:~/cli$ npm i -g
npm WARN checkPermissions Missing write access to ~/cli/node_modules/nan
npm ERR! path /home/ole/cli/node_modules/nan
Thoughts?
If I try to cd node_modules/nan there is no such directory ... so that's one thing. I'm not sure why it's trying to access that?
Deleted all the contents of my local ~/.npm-packages directory and reinstalled and now it works:
cd ~/.npm-packages
rm -fr *
cd ~/cli
npm i -g

NPM installing package ENOENT Error

I have installed npm on my Laravel Project.
When I run npm install --save vue-draggable
I get this error
ENOENT: no such file or directory, rename '/Users/victori/Desktop/project-1/node_modules/npm/node_modules/dezalgo
Although, when I run npm install -g --save vue-draggable it works. Although, id want it onto my actual project files.
NPM Verson: 5.6.0
Node: v8.9.1

Install yarn in a docker container says missing dependency

I'm using the node:6.7.0 image as my docker container and then follow the installation guide for yarn
sudo apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
echo "deb http://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
Then I do
apt-get update && apt-get install yarn
But at this point I get an error message which says
yarn : Depends: nodejs (>= 4.0.0) but it is not going to be installed
I've echoed node -v before the install and it also says 6.7.0
Anything that I'm missing?
robertklep is right - if you check the Dockerfile for Node you'll see they install Node by downloading the TAR, not through APT. You can check this by running an interactive container:
> docker run -it node:6.7.0 bash
root#465fa07437c9:/# dpkg -s nodejs
dpkg-query: package 'nodejs' is not installed and no information is available
You can use NPM in your Dockerfile instead:
FROM node:6.7.0
RUN npm install -g yarn

npm: not found when setting up Jenkins Server?

This is my first time setting up a jenkins server. The build is using Amazon's EC2 and Ubuntu 14.04.
I've installed node and npm via nvm.
node -v
>v0.11.14
npm -v
>2.0.0
The repo pulls down just fine into my /var/lib/jenkins/workspace/morningharwood folder.
Problem: When I add my script it breaks
Here's my build script which errors out? I have no idea what i'm doing. I copied this from a tutorial.
QUESTION: How do I properly write my script to npm install, bower install and lastly, grunt test
You could install node, npm, bower and grunt by doing following:
sudo apt-get install node
sudo npm install bower
sudo npm install grunt
To install a package from local source, use
npm install /path
Try using NodeJS plugin for Jenkins: https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin
This will solve npm command not found issue on jenkins even installed on server
sudo mkdir /usr/local/nvm
export NVM_DIR=/usr/local/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh |NVM_DIR=/usr/local/nvm bash
. /usr/local/nvm/nvm.sh
nvm install 10.15.3 -g
npm install #angular/cli -g
Include following on build execute shell command in jenkins:
export PATH="$PATH:/usr/local/nvm/versions/node/v10.15.3/bin"
npm install

Categories