I'm trying to dockerize a project, but I'm having issues in the npm install process with my Gulp 4 dependency. I'm using Gulp 4 because we needed some of the new features, but all the instructions I've seen for using the prerelease version of Gulp 4 is to use the github branch url. Here is the offending dependency:
"gulp": "github:gulpjs/gulp#4.0",
And here is the error I get when I try to run docker build -t user/project .:
npm ERR! Error: No compatible version found: gulp#'github:gulpjs/gulp#4.0'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.7","0.0.8","0.0.9","0.1.0","0.2.0","1.0.0","1.1.0","1.2.0","1.2.1","2.0.0","2.0.1","2.1.0","2.2.0","2.3.0","2.4.0","2.4.1","2.6.0","2.6.1","2.7.0","3.0.0","3.1.1","3.1.2","3.1.3","3.1.4","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.3.0","3.3.1","3.3.2","3.3.4","3.4.0","3.5.0","3.5.1","3.5.2","3.5.5","3.5.6","3.6.0","3.6.1","3.6.2","3.7.0","3.8.0","3.8.1","3.8.2","3.8.3","3.8.4","3.8.5","3.8.6","3.8.7","3.8.8","3.8.9","3.8.10","3.8.11","3.9.0","3.9.1"]
npm ERR! at installTargetsError (/usr/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR! at /usr/lib/node_modules/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/lib/node_modules/npm-registry-client/lib/get.js:148:7)
npm ERR! at /usr/lib/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:108:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.19.0-51-generic
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /src
npm ERR! node -v v0.10.42
npm ERR! npm -v 1.3.6
This is the Dockerfile I'm currently using:
# Using CentOS
FROM centos:centos6
# Enable Extra Packages for Enterprise Linux (EPEL) for CentOS
RUN yum install -y epel-release
# Install Node.js and npm
RUN yum install -y nodejs npm
COPY package.json /src/package.json
# Install app dependencies
RUN cd /src; npm install
# Bundle app source
COPY . /src
# Run server
EXPOSE 8080
CMD ["npm", "start"]
Is there a way to get Docker to be ok with the github url? Or is there an alternate way to include the dependency that Docker would be happy with?
The issue was caused by older version of node available on the base image.
The version of node was not compatible with gulp version.
A base image with newer version of node resolved the issue.
Related
I'm trying to install electron so I can create an app. I have the latest npm installed (8.3.1) and when I run "npm install electron --save-dev" I keep getting this error:
PS C:\Users\archa\HCIRA\blah> npm install electron --save-dev
npm ERR! code 1
npm ERR! path C:\Users\archa\HCIRA\blah\node_modules\electron
npm ERR! command failed
npm ERR! command bash -c node install.js
npm ERR! Windows Subsystem for Linux has no installed distributions.
npm ERR! Distributions can be installed by visiting the Microsoft Store:
npm ERR! https://aka.ms/wslstore
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\archa\AppData\Local\npm-cache\_logs\2022-01-
15T14_42_33_350Z-debug-0.log
"blah" is the folder where all my code is (index.js, package.json etc.). I've tried using the resources I found on Stack and GitHub but none of them have worked out for me at all. I was even told that the "--save-dev" suffix would be useful for installing Electron on Windows but it didn't work.
I'm a newbie in coding so please take it easy on me.
I have project on github, made by softwarehouse - its MVP of an app made with Django Rest framework, React app, Docker.
Now I want to run it on my mac, and there is an issue.
When i run docker-compose.yml i start with docker-compose up, it is instaling all packages untill it goes to the step where it tries to instal npm, and i get an error:
npm notice
npm notice New patch version of npm available! 7.4.0 -> 7.4.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.4.3>
npm notice Run `npm install -g npm#7.4.3` to update!
npm notice
ERROR: Service 'pet-frontend' failed to build : The command '/bin/sh -c npm install --silent' returned a non-zero code: 1
Failed to deploy 'Compose: docker-compose.yml': `docker-compose` process finished with exit code 1
I don't know why i cannot instal latest version? I have newest node.js where npm is 7.4.0.
How i can force install of 7.4.0 or how to install 7.4.0? so deployment could go further?
__ more info __
frontend dockerfile looks like this:
FROM node:latest
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
RUN npm install --silent
RUN npm install react-scripts#3.4.1 -g --silent
COPY . ./
CMD ["npm", "start"]
when i add there 'RUN npm install -g npm#7.4.3' - still get the same error
When i run npm without --silent i get this error:
npm notice
npm notice New patch version of npm available! 7.4.0 -> 7.4.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.4.3>
npm notice Run `npm install -g npm#7.4.3` to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: prop-types#15.6.0
npm ERR! node_modules/prop-types
npm ERR! peer prop-types#"<=15.6.0" from check-prop-types#1.1.2
npm ERR! node_modules/check-prop-types
npm ERR! dev check-prop-types#"^1.1.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-leaflet-search#"^2.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: prop-types#15.7.2
npm ERR! node_modules/prop-types
npm ERR! peer prop-types#"^15.7.2" from react-leaflet-search#2.0.1
npm ERR! node_modules/react-leaflet-search
npm ERR! react-leaflet-search#"^2.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-26T10_49_01_333Z-debug.log
ERROR: Service 'petsy-frontend' failed to build : The command '/bin/sh -c npm install' returned a non-zero code: 1
Failed to deploy 'Compose: docker-compose.yml': `docker-compose` process finished with exit code 1
I added the following line before npm install and it worked for me. It picks the latest npm version and install in your directory
RUN npm install -g npm#7.19.1
npm install npm#{latest version}
You can use this, it worked for me just now
I tried to install npm and I got the following error.
I already removed npm and reinstall it again, but I again got the following error:
npm ERR! Linux 4.15.0-30-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! vx-leave-system#0.0.1 start: `node ./tools/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vx-leave-system#0.0.1 start script 'node ./tools/server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vx-leave-system package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./tools/server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vx-leave-system
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vx-leave-system
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/seelan/Documents/vx-leave-system/npm-debug.log
How can I fix this?
On ubuntu 18.04 following steps saved me
To remove the distro-stable version, type the following:
sudo apt remove nodejs
This command will remove the package and retain the configuration files.
sudo apt purge nodejs
As a final step, you can remove any unused packages that were automatically installed with the removed package:
sudo apt autoremove
Refresh your local package index by typing:
sudo apt update
Enable the NodeSource repository by running the following command
(optinal) If you need to install another version, for example 14.x, just change setup_12.x with setup_14.x
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
Once the NodeSource repository is enabled, install Node.js and npm by typing:
sudo apt install nodejs
Verify that the Node.js and npm were successfully installed by printing their versions:
node --version (v12.18.4)
npm --version (6.14.6)
It seems to me that you're running a newer version of Node, but an outdated version of NPM.
You can do either of the following:
Try the latest stable version of NPM:
You can upgrade to the latest version of npm using: npm install -g npm#latest
Uninstall Node form your machine completely, go to their website and install the latest stable Node version. NPM comes with it.
I faced this issue too today and the problem was caused by an upgrade in my node and npm version. Guess my project dependencies were still running on older versions of node and npm
I fixed it by deleting the node_modules folder and run
npm install
I hope this helps
This looks like a permissions issue in your home directory. To reclaim ownership of the .npm directory execute:
sudo chown -R $(whoami) ~/.npm
Check the updates of dependencies
npm outdate
Run the next command to update dependencies
npm update
Remove the path folder directory C:\Users\ACER\AppData\Local**\npm-cache_logs\2021-12-29T13_41_22_984Z-debug-0.log**
and then run this command in your CLI npm install -g npm#latest
this works with you
I am trying to install nuclide on Atom but I am getting the follwong error. When I run
apm install nuclide
Installing “nuclide#0.125.0” failed.Hide output…
npm WARN engine nuclide#0.125.0: wanted: {"atom":">=1.5.3","node":">=4.1.1"} (current: {"node":"0.10.40","npm":"2.13.3"})
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/ammathu/Downloads/Atom 2.app/Contents/Resources/app/apm/bin/node" "/Users/ammathu/Downloads/Atom 2.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Users/ammathu/.atom/.apm/.apmrc" "--userconfig" "/Users/ammathu/.atom/.apmrc" "install" "/private/var/folders/sk/rxnvp2hs2nd0xp3w_bsq3f1d6b3pqf/T/d-116222-56925-dimbjc/package.tgz" "--target=0.34.5" "--arch=x64"
npm ERR! node v0.10.40
npm ERR! npm v2.13.3
npm ERR! version not found: relative-date#1.1.2
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /private/var/folders/sk/rxnvp2hs2nd0xp3w_bsq3f1d6b3pqf/T/apm-install-dir-116222-56925-votedf/npm-debug.log
Any idea how to fix it?
node -v gives me v5.0.0`
I've been able to install it from source:
http://nuclide.io/docs/advanced-topics/building-from-source/#linux__building
Run the following commands to build Nuclide from source.
# Clone the source
$ git clone https://github.com/facebook/nuclide.git
$ cd nuclide
# Install dependencies
$ npm install
# Link the 'nuclide' package to Atom's package directory
$ apm link
Verify the installation by:
Open Atom.
Go to Atom | Preferences.
Click on Packages.
Verify nuclide as one of the packages.
This solved it for me.
$ git clone https://github.com/facebook/nuclide.git
$ cd nuclide
# Install dependencies
$ yarn --pure-lockfile
# Link the 'nuclide' package to Atom's package directory
# You could also use apm link --dev ... see Development Mode below.
$ apm link
The npm install did not install all the modules necessary. Kept giving me errors, could not find module-...
This is given in the their docs.
https://nuclide.io/docs/advanced-topics/building-from-source/#linux__building
I am attempting to install an npm package (markdown-pdf) as part of my Travis-CI build which I believe is not compatible with old versions of Node. On my local machine, I am running Node version 0.10.36, and it works here, so I added what I believe to be the accepted way of defining a specific version to the top of my .travis.yml file (although I'm not clear on that either). The MCVE version of the full file is below.
language: node_js
node_js:
- "0.10"
install:
- sudo apt-get install npm
- npm config set registry http://registry.npmjs.org/
- sudo npm install -g markdown-pdf
script:
- echo "stuff was installed."
At the top of the build log, I see the following, which seems to indicate that my change worked:
$ nvm install 0.10
######################################################################## 100.0%
Now using node v0.10.40
$ node --version
v0.10.40
$ npm --version
1.4.28
$ nvm --version
0.23.3
However, further down the log, when travis attempts to execute sudo npm install -g markdown-pdf, the log reports the following. Notice that it suggests that the package might not be compatible with the version of Node that is installed, and it claims that I'm using Node v0.6.12.
$ sudo npm install -g markdown-pdf
npm http GET http://registry.npmjs.org/markdown-pdf
npm http 200 http://registry.npmjs.org/markdown-pdf
npm ERR! Error: No compatible version found: markdown-pdf
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log npm
npm ERR!
npm ERR! System Linux 2.6.32-042stab108.3
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "markdown-pdf"
npm ERR! cwd /home/travis/build/ahemmeter/ahemmeter.github.io
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: markdown-pdf
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log
npm not ok
I think I've provided enough information, but you can also look at the public build logs for the project and the github repository it's building.
Have I made a mistake in declaring which version of Node to use? Do I need to (or should I) do something similar for npm, nvm, and markdown-pdf? How can I force npm-install to use the newer version of Node rather than the old one?
Note that I set the repository to download over HTTP instead of HTTPS. When I did that, the error message changed from "failed to fetch from registry: markdown-pdf" to "No compatible version found: markdown-pdf", which seemed like a step in the right direction, so I kept it; however, I mention it here in case there is a possibility that it causes a conflict.
In order to specify dependencies when using node.js, travis seems to expect a package.json file. You can also use this to specify which version of the node package you want to download.
.travis.yml
language: node_js
node_js:
- "0.10"
script:
- echo "stuff was installed."
package.json
{
"name" : "ahemmeter.github.io",
"version" : "0.0.0",
"dependencies" : {
"markdown-pdf" : "5.3.x"
}
}
Note from OP: This is the answer I found, but If someone posts an answer that does not involve using a package.json file (this is just a test suite rather than a package and I don't want to publish it as a package), I'll mark that answer as accepted.