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).
Related
I have 4 packages in my package.json:
"#CT/package-1": "*",
"#CT/package-2": "*",
"#CT/package-3": "*",
"#CT/package-4": "*",
All four packages are not on the NPM registry, but locally linked.
In each package directory I did:
sudo npm link
After that I went into my main project and linked all packages like so:
npm link #CT/package-1
npm link #CT/package-2
npm link #CT/package-3
npm link #CT/package-4
For each command it outputs the linked chain of the sym-links, I checked the paths of each one, and it's correct. If I go in the node_modules folder of my main project and follow #CT/package-X I will end up in my local package directory.
Now I expect that I can run npm i on my main project and it won't try to install those packages from the npm registry. This works for package 2-4, but it does not work for package-1:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://npm.pkg.github.com/#CT%2fpackage-1 - npm package "package-1" does not exist under owner "CT"
As soon as I remove "#CT/package-1": "*", from my package.json, npm i will success, because it seems to right-fully skip package 2-4, just not package-1.
Now I inspected all four package projects, and it makes no sense to me. All projects compile, all package.json contain the correct package name. Here is the package.json of my first faulty package:
{
"name": "#CT/package-1",
"version": "0.0.2",
"description": "",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
"unpkg": "dist/plugin.js",
"files": [
"android/src/main/",
"android/build.gradle",
"dist/"
],
"author": "martin-braun",
"license": "ISC",
"keywords": [
"capacitor",
"plugin",
"native"
],
"scripts": {
"lint": "npm run prettier -- --check",
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
"build": "npm run prettier && npm run clean && tsc && rollup -c rollup.config.js",
"clean": "rimraf ./dist",
"watch": "tsc --watch",
"prepublishOnly": "npm run build"
},
"devDependencies": {
"#capacitor/android": "^3.0.0",
"#capacitor/core": "^3.0.0",
"#capacitor/docgen": "^0.0.18",
"#ionic/eslint-config": "^0.3.0",
"#ionic/prettier-config": "^1.0.1",
"eslint": "^7.11.0",
"prettier": "~2.2.0",
"prettier-plugin-java": "~1.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.32.0",
"typescript": "~4.0.3"
},
"peerDependencies": {
"#capacitor/core": "^3.0.0"
},
"prettier": "#ionic/prettier-config",
"eslintConfig": {
"extends": "#ionic/eslint-config/recommended"
},
"capacitor": {
"android": {
"src": "android"
}
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/CT"
},
"dependencies": {}
}
.npmrc
registry=https://npm.pkg.github.com/#CT
registry=https://registry.npmjs.org
When I linked the project on my main project it shew the right paths (i.e.)
/Users/mb/Projects/CT/MAIN/node_modules/#CT/package-1 -> /Users/mb/node_module_collections/ekol/lib/node_modules/#CT/package-1 -> /Users/mb/Projects/CT/package-1
What could I try to find the issue? Again, package 2-4 won't cause npm i to fail, but package.json and npmrc look similar. I'm thankful for any advice.
node v13.12.0
When I try to build one of the NextJS apps in my monorepo, I get the error:
$ rm -r packages/library/node_modules/; rm -r packages/daily/node_modules/; rm -r node_modules/; rm -r packages/shared/node_modules; rm package-lock.json; sudo rm -r packages/daily/.next/; npm i; npm --prefix packages/daily/ run build
> next build
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types
info - Creating an optimized production build
Failed to compile.
HookWebpackError: processor is not a function
> Build error occurred
Error: > Build failed because of webpack errors
at /home/ubuntu/cal-frontend/packages/daily/node_modules/next/dist/build/index.js:397:19
at async Span.traceAsyncFn (/home/ubuntu/cal-frontend/packages/daily/node_modules/next/dist/telemetry/trace/trace.js:60:20)
at async Object.build [as default] (/home/ubuntu/cal-frontend/packages/daily/node_modules/next/dist/build/index.js:77:25)
The strange thing is that the node/npm version and code are exactly the same as a few days ago when I last ran this command successfully. I have never had this error before. I even tried cloning to a brand new Linux EC2 instance to see if there was some cached file screwing it up but I got exact same error. I am still able to re-deploy the latest commit on Heroku from a few days ago.
The next dev command works fine still.
The issue started happening when I tried to create a new website under packages/ . But the error is persisting even after I reverted to a commit before I made that code.
The monorepo contains two websites that share a package of shared code inside the repo called shared. Here is the webpack next.config.js file for the package/daily app. Again, no code has changed since the error started.
const withFonts = require('next-fonts');
const withTM = require('next-transpile-modules')(['#my-repo-name/shared']);
require('dotenv').config({ path: '../../.env' });
module.exports = withTM(withFonts({
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.
ignoreDuringBuilds: true,
},
webpack(config, options) {
return config;
},
}));
node version: v16.10.0
npm version: 7.24.0
(I also tried building using 16.14 and 8.3, and had the same error)
Also the root level package.json (with personal details redacted):
{
"name": "my-repo-name",
"version": "1.0.0",
"workspaces": {
"packages": [
"packages/*"
]
},
"keywords": [],
"author": "redacted-for-stack-overflow#stackoverflow.org",
"license": "UNLICENSED",
"description": "REDACTED FOR STACK OVERFLOW",
"engines": {
"node": "16.10.0"
},
"cacheDirectories": [
"node_modules",
"packages/library/.next/cache"
],
"scripts": {
"lint": "eslint . --ext js,jsx",
"build": "npm run build --prefix packages/$APP_NAME"
},
"dependencies": {},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-next": "^11.1.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0"
}
}
There was an incident yesterday which was causing the issue at Vercel. It should be fixed now.
Adding resolutions keys in package.json solved this for me. Hope this should be a temporary issue with vercel.
"resolutions": {
"cssnano-preset-simple": "3.0.0"
}
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've had no problems manually publishing my scoped package to the NPM registry however I found the np module could be used to ensure no steps were skipped in the process.
I've configured only a couple options in my package.json as the defaults are otherwise sensible for me. (This is the package.json for the npm package itself)
{
"name": "#scope/package",
"version": "0.0.6",
"description": "blah",
"main": "index.js",
"scripts": {
"prepublishOnly": "npm run release",
"release": "npm run build:dev && npm run build:prod",
"build:prod": "NODE_ENV=production rollup -c",
"build:dev": "NODE_ENV=development rollup -c",
"test": "echo \"No tests specified\""
},
"repository": {
"type": "git",
"url": "http://blah/blah/blah"
},
"author": "blah",
"license": "ISC",
"devDependencies": {
...
},
"peerDependencies": {
...
},
"np": { <----
"yarn": false, <----
}, <----
"publishConfig": { <----
"access": "public" <----
} <----
}
Unfortunately when I run np I receive the error:
Command failed with exit code 128 (Unknown system error -128): git log --format=%s %h commit sha commit sha..HEAD
The first commit sha is the initial commit from Gatsby.
If you've used Gatsby you may have seen it:
Initial commit from gatsby: (https://github.com/gastbyjs/gatsby-starter-hello-world.git)
For context: I'm creating a component library where the parent dir is setup using GatsbyJS so that I can use it for the demo site while the child dirs under src/packages will be the individual components that will be published to the npm registry. So the demo site is bundled with Gatsby while the packages are bundled using rollup.
Why am I receiving this -128 error code and how do I fix it?
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.