When deploying an OpenShift node.js project with a depdency on browserify 4.0.0, I get an error installing browserify's dependencies. Specifically:
...
remote: npm ERR! Error: No compatible version found: stream-browserify#'^1.0.0'
remote: npm ERR! Valid install targets:
remote: npm ERR! ["0.0.0","0.0.1","0.0.2","0.0.3","0.0.4","0.1.0","0.1.1","0.1.2","0.1.3","1.0.0"]
...
Given that stream-browserify's version is ^1.0.0 according to browserify's depdency and that openshift is suggesting 1.0.0 is a valid install target, why is this failing? I have seen this error in other cases, whenever the highest available openshift version fits the careted package.json version.
Am I misunderstanding what the caret means? Is this an OpenShift bug?
My package.json:
{
"name": "SampleApp",
"version": "1.0.0",
"description": "do things online",
"keywords": [
"OpenShift",
"Node.js",
"application",
"openshift"
],
"author": {
"name": "J",
"email": "j#email.com",
"url": ""
},
"homepage": "http://www.openshift.com/",
"repository": {
"type": "git",
"url": "https://github.com/openshift/origin-server"
},
"engines": {
"node": "0.x",
"npm": "1.x"
},
"dependencies": {
"body-parser": "1.x",
"browserify": "4.0.0",
"cookie-parser": "1.x",
"cookie-session": "1.x",
"express": "4.x",
"fast-csv": "0.x",
"multer": "0.0.5",
"pg": "3.x",
"sql": "0.x",
"xlsx-extract": "0.0.4"
},
"devDependencies": {
},
"bundleDependencies": [],
"private": true,
"main": "server.js",
"scripts": {
"build-js": "browserify public/index.js -o public/index-bundle.js & browserify public/intake.js -o public/intake-bundle.js",
"start": "npm run build-js && node server.js"
}
}
This behaviour could be because of different versions on node and npm on your local machine and openshift environment. Start by fixing "engines" attribute in your package.json, something as below:
"engines": {
"node": ">= 0.10",
"npm": ">= 1.4"
}
If still the issue is there (on openshift) it is due to the unavailability of the nodejs/npm required versions on openshift environment. For example, as of today, on my local machine I may be using node version 0.10.28 and npm version 1.4.9, but on openshift nodejs default cartridge I have to be content with nodejs version 0.10.5 and npm version 1.2.17, which is a big gap.
So, in this case, the easiest way to get around is by using "npm shrinkwrap", which freezes the nested dependency versions that ought to be used, hence doing away with varied behaviour of npm versions to figure out the nested dependency to install.
Can read about shrinkwrap here: https://www.npmjs.org/doc/cli/npm-shrinkwrap.html
So, on your local machine:
run npm install and make sure everything works.
fire npm shrinkwrap This will create a file - "npm-shrinkwrap.json", with the required shrinkwrap info. Add, commit and push the file to the openshift git repo.
Related
Before posting the issue, I surfed on all possible websites to fix the issue with Node.js- npm cli I am encountering. None of the answers worked for me and I got stuck with. Can someone help to fix it?
The npm cli was running perfectly and it suddenly started to work giving me the traceback Please verify that the package.json has a valid 'main' entry. Even if I re-installed the node.js it has not resolved the issue. (see screenshot below)
The version node.js 16.17.1 on Windows 10
Screenshot:
The content of the package.json
{
"name": "npm-bundled",
"version": "1.1.2",
"description": "list things in node_modules that are bundledDependencies, or transitive dependencies thereof",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/npm-bundled.git"
},
"author": "Isaac Z. Schlueter <i#izs.me> (http://blog.izs.me/)",
"license": "ISC",
"devDependencies": {
"mkdirp": "^0.5.1",
"mutate-fs": "^1.1.0",
"rimraf": "^2.6.1",
"tap": "^12.0.1"
},
"scripts": {
"test": "tap test/*.js -J --100",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags"
},
"files": [
"index.js"
],
"dependencies": {
"npm-normalize-package-bin": "^1.0.1"
}
}
Thanks in advance.
AKA
[Solved]:
Thanks everyone. The problem was lying in the directory C:\Users\your_comp_name\AppData\Local\node & C:\Users\your_comp_name\AppData\Roaming\npm that only needs to be removed to run npm cli further.
As the title says, node cannot find main.js. I am doing this through replit and my .replit file is run = "npm test". My package.json file is
{
"name": "Adventure",
"version": "1.0.0",
"description": "This is The Adventure Bot By BrainDead_Dev",
"main": "main.js",
"dependencies": {
"#replit/database": "^2.0.1",
"discord-buttons": "^4.0.0-deprecated",
"discord.js": "^13.6.0",
"moment": "^2.29.1",
"winston": "^3.6.0"
},
"devDependencies": {},
"scripts": {
"test": "main.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/BrainDeadDev/Adventure.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/BrainDeadDev/Adventure/issues"
},
"homepage": "https://github.com/BrainDeadDev/Adventure#readme"
}
This is for a discord bot, and it has been working perfectly fine up until the point where I wanted to update discord.js and had to reinstall npm. Any help would be appreciated as I am quite lost.
When you updated the discord.js package, it now requires a more current version of node js (v16.6).
To update to the version of node using npm simply run:
npm install -g n
If you are using nvm you can do:
nvm install 16.6
then tell nvm to use the new version:
nvm use 16.6
Then you can check the version you are using by running:
node --version
Edit for Repl.it:
following this blog, you should be able to do it by running this:
npm i --save-dev node#16 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH
You can also try following this question on repl.it forums
We have a custom jupyterlab extension that fails to install for nodejs=14.14.0 (and for 15.2.1) (installed using conda).
Here's how the package.json file looks like for the labextension:
{
"name": "my-custom-ext",
"version": "0.1.0",
"description": "Integrate JupyterLab with ext",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/my_name/myextension",
"bugs": {
"url": "https://github.com/my_name/myextension/issues"
},
"license": "BSD-3-Clause",
"author": "xyz",
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/my_name/myextension.git"
},
"scripts": {
"build": "tsc",
"clean": "rimraf lib",
"prepare": "npm run clean && npm run build",
"watch": "tsc -w"
},
"dependencies": {
"#jupyterlab/application": "^3.0.6",
"#jupyterlab/apputils": "^3.0.5",
"#jupyterlab/coreutils": "^5.0.3",
"#jupyterlab/docregistry": "^3.0.6",
"#jupyterlab/launcher": "^3.0.5",
"#jupyterlab/mainmenu": "^3.0.5",
"#jupyterlab/notebook": "^3.0.6",
"#jupyterlab/services": "^6.0.5",
"#lumino/commands": "^1.12.0",
"#lumino/coreutils": "^1.5.3",
"#lumino/disposable": "^1.4.3",
"#lumino/widgets": "^1.16.1"
},
"devDependencies": {
"#jupyterlab/builder": "^3.0.0",
"rimraf": "^3.0.2",
"typescript": "~4.1.3"
},
"jupyterlab": {
"extension": true
}
}
Here's the error jupyter labextension install --no-build my-custom-ext :
Node v14.14.0
Yarn configuration loaded.
> node /opt/conda/lib/python3.8/site-packages/jupyterlab/staging/yarn.js install
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-yarn install v1.21.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
warning #blueprintjs/core#3.52.0: Invalid bin entry for "upgrade-blueprint-2.0.0-rename" (in "#blueprintjs/core").
warning #blueprintjs/core#3.52.0: Invalid bin entry for "upgrade-blueprint-3.0.0-rename" (in "#blueprintjs/core").
error #npmcli/fs#1.1.0: The engine "node" is incompatible with this module. Expected version "^12.13.0 || ^14.15.0 || >=16". Got "14.14.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
> /opt/conda/bin/npm pack /home/jovyan/my-custom-ext
-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-
> my-custom-ext#0.1.0 prepare /home/jovyan/my-custom-ext
> npm run clean && npm run build
> my-custom-ext#0.1.0 clean /home/jovyan/my-custom-ext
> rimraf lib
> my-custom-ext#0.1.0 build /home/jovyan/my-custom-ext
> tsc
src/index.ts(1,72): error TS2307: Cannot find module '#jupyterlab/apputils' or its corresponding type declarations.
....
....
....
ValueError: "/home/jovyan/my-custom-ext" is not a valid npm package
Exiting application: lab
Running "npm ls" I got :
├─┬ #jupyterlab/builder#3.2.5
│ ├─┬ terser-webpack-plugin#4.2.3
│ │ ├─┬ cacache#15.3.0
│ │ │ ├─┬ #npmcli/fs#1.1.0
changed package.json to :
"devDependencies": {
"#jupyterlab/builder": "=3.2.4",......
But that didnt help. Still got the same error
Note : https://www.npmjs.com/package/#npmcli/fs :1.1.0 was published 5 days ago.
Please help how to fix
This fragment is relevant:
Expected version "^12.13.0 || ^14.15.0 || >=16". Got "14.14.0"
It tells you that you need to use node 14.15.0 or newer 14.x and that you cannot use 13.x, 15.x. But you have 14.14.0 - this means that you need to upgrade your node.js.
You mention conda - it might be that you use outdated default channels and therefore you get the old minor release of 14.x; conda-forge channel has all the versions and I recommend switching to it. If you already use conda-forge and cannot get the newer version, you may want to try using mamba as it has a better dependency resolver.
Note: 15.x and newer is not well supported by JupyterLab 3.x at the moment anyways (among other because not all dependencies upgraded to 16.x yet as Node follow odd-even version cadence where only even numbers are stable long enough for the wider ecosystem to have incentive to migrate).
I looked at and executed almost every single answer on this post:
The CLI moved into a separate package: webpack-cli
It has not helped.
Allow me to present my case:
So I have developed a container folder, a separate application where I ran npm init -y and then installed the following:
npm install html-webpack-plugin#4.5.0 nodemon webpack#5.3.2 webpack-cli#4.1.0 webpack-dev-server#3.11.0
Then I went into my package.json file and added the start script:
{
"name": "container",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack serve"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"html-webpack-plugin": "^4.5.0",
"nodemon": "^2.0.6",
"webpack": "^5.3.2",
"webpack-cli": "^4.1.0",
"webpack-dev-server": "^3.11.0"
}
}
When I go to terminal and run npm start, this is why I get every single time:
➜ container npm start
> container#1.0.0 start /Users/luiscortes/Projects/ecommRS/container
> webpack serve
[webpack-cli] The command moved into a separate package: #webpack-cli/serve
? Would you like to install #webpack-cli/serve? (That will run npm install -D #webpack-cli/serve) (Y/n) › true
And yes even if I choose Y or true and it runs its npm install -D #webpack-cli/serve, when I go back to running npm start it just gives me the same error over and over again.
Apparently, this is an issue with webpack-cli#4.1.0. I upgraded to webpack-cli#4.2.0 and now it works.
I am trying to deploy a Sails.js app to Bluemix and we are getting the following error during the deploy stage in the toolchain on Bluemix (When the CF PUSH command is called):
npm ERR! Cannot read property 'pause' of undefined
I understand the trace goes to the npm-error.log file, however, I haven't been able to get to it as we cannot ssh in to see whats in the file as the application is in its "off" state after a bad deploy.
This same code was successfully deployed with both Cf push {app name}} and through a simple build and deploy toolchain in Bluemix just 8 days ago.
In the build stage I can run Npm install and npm update just fine. However, it seems to do this again in the deploy stage regardless and it fails. Here is some detail on this failure
NODE_ENV=production
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
Visit http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring
NODE_HOME=/tmp/app/.cloudfoundry/0/node
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
Restoring cache
Loading 3 from cacheDirectories (default):
- .npm
- .cache/yarn (not cached - skipping)
- bower_components (not cached - skipping)
Installing node modules (package.json) Building dependencies
sails#0.12.13 preinstall /tmp/app/node_modules/sails
node ./lib/preinstall_npmcheck.js
Sails.js Installation: Checking npm-version successful
npm ERR! Cannot read property 'pause' of undefined
npm ERR! /tmp/app/.npm/_logs/2017-09-09T17_02_48_660Z-debug.log
**ERROR** Unable to build dependencies: exit status 1
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
Destroying container
npm ERR! A complete log of this run can be found in:
Successfully destroyed container
Package.json file
{
"name": "myApp",
"private": true,
"version": "0.0.1",
"description": "Stuff my app does",
"keywords": [
"Cool Apps"
],
"dependencies": {
"bcryptjs": "^2.4.3",
"cacheman": "^2.2.1",
"ejs": "2.3.4",
"elasticsearch": "^13.0.0-rc2",
"find-remove": "^1.0.1",
"fs": "0.0.1-security",
"grunt": "1.0.1",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-coffee": "1.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "1.0.1",
"grunt-contrib-jst": "1.0.0",
"grunt-contrib-less": "1.3.0",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.5.2",
"include-all": "^1.0.0",
"jsonwebtoken": "^7.3.0",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"passport": "^0.2.x",
"passport-http-bearer": "^1.0.1",
"passport-idaas-openidconnect": "^1.1.0",
"passport-local": "^1.0.0",
"rc": "1.0.1",
"request": "^2.81.0",
"request-promise": "^4.2.0",
"sails": "~0.12.13",
"sails-disk": "~0.10.9",
"sails-mongo": "^0.12.2",
"stream": "0.0.2",
"uuid-1345": "^0.99.6",
"validator": "^7.0.0",
"natural-sort": "^1.0.0"
},
"scripts": {
"start": "node app.js"
},
"engines": {
"node": "^8.0.x",
"npm": "^5.0.x"
},
"main": "app.js",
"author": "Scott N",
"license": ""
}
Things I've tried so far.
-change node versions
-changed npm versions
-change dependencies versions to include the ^ prefix
-removed all dependencies but Sails in the package.json file
So Sails.js and the Nodebuildpack/Bluemix aren't playing well with each other.
Any help would be appreciated.
Thank you
It happens to me just the same. and I've to roll back the prev version of npm: 5.3.0 and it's working now. (BTW: macOS)
The error only happens when I update my npm version like this:
Update available 5.3.0 → 5.4.1
Run npm i -g npm to update
The best way to handle it is to update your package.json to use engines like so
"description": "a Sails application",
"keywords": [],
"engines": {
"node": "6.10.1",
"npm": "5.3.0"
},
Got this issue while trying to push to heroku which seems to be the npm version specified by #m-t, and also specifying the versions like above makes ibm bluemix pick it up as default node engine instead of using the latest stable version.
And don't forget to always specify your node and npm versions directly, instead of adding tilde or caret, this just to be safe. check https://stackoverflow.com/a/22345808/5836034 for more about tilde and caret
you can still check #sai-vennam answer here for more info
So I rolled back the sails version in the package.json file from 0.12 to 0.11 and it deployed fine. So CF PUSH and the newest sails version are not getting along on Bluemix. This was using Node 8.0 and NPM version ^5.0.x