No matching version found for internal-slot#^1.0.3 - node.js

I'am facing a problem with npm installation.
I am trying to make an npm install on an Angular application but i got a message depicted on the picture above :
No matching version found for internal-slot#^1.0.3
I have tried to check which package use the internal-slot (npm ls internal-slot), but returns me empty!
So to figure out from where this problem is produced, I removed set of npm dependencies by set, and i made an install after each modification, but unfortunately the problem persist.
Any kind of help will be appreciable!

NPM told you which package this is a dependency of: es-abstract (second to last line).
Looking at NPM, I see that internal-slot has a most recent version of 1.0.3, which tells me there might be a conflict with another Angular dependency (or dependency chain).
Try try adding the package directly to your project, but with an exact version number:
npm i internal-slot#1.0.3 --save-exact
This will specify an exact version, not a "compatible" one (no ^ prefix on the version in package.json), and will likely override (or expose) other dependencies.

Related

How to build node.js projects against local versions of the dependencies?

I've been trying to build a relatively complex node.js project (https://github.com/edrlab/thorium-reader/) against local versions of some dependencies.
I can build and run the project with the non-local dependencies without problems.
I've tried different "routes", such as adding the dependencies using npm install --save <path-to-dependency> or just adding a file:<path-to-dependency> reference to the package.json file. I've checked out the exact versions of each dependency.
npm install doesn't show any errors.
Now when I run npm run start I get type errors that don't quite understand, such as:
Argument of type 'import("~/repositories/thirdparty/thorium/r2-opds-js/dist/es6-es2015/src/opds/opds2/opds2-facet").OPDSFacet'
is not assignable to parameter of type
'import("~/repositories/thirdparty/thorium/thorium-reader/node_modules/r2-opds-js/dist/es6-es2015/src/opds/opds2/opds2-facet").OPDSFacet'.
Types of property 'Links' are incompatible.
Does anyone have a hint for me what I am doing wrong here ?
I'm using node.js version 17.2.0 and npm version 8.2.0.
Best,
N
Ok, after fiddling around for hours I found that using npm link does the trick. Not sure what the differences are, npm install didn't work at all, neither did putting the references in package.json.
That is, go to the dependency's repository, run npm link, build the dependency as a module, THEN go to the main repository and run npm link <dependency> --save.
Now the build process works.
Not sure why there are the two different method, one of which doesn't work a all in this case.

Sorry, there's a problem with nodist. When trying to initilise a new npm project

I am following the following guide from GitHub Here but when I enter npm init I keep getting the error:
Sorry, there's a problem with nodist. Couldn't resolve node version
spec %s: %s 11.13.0 Couldn't find any matching version
I have followed the previous steps and set the version to v10.15.3, but the error keeps appearing every time I use nvm. I have also set the version to v11.13.0, as this is what the error is requesting, but I still get the same result. Installed versions include: 11.13.0, 10.16.0, 10.15.3, 8.11.2, 0.12.0
Any help with this would be much appreciated!
There are several reasons which can cause this problem:
If due to some reasons like poor internet connection your node or npm versions you have downloaded are corrupted. In this case you need to remove the files .npm-version-global and .node-version-global as well as empty the folders v, v-64 and npmv within the installation of the Nodist folder.
You have a local version of the node specified in .node-version file in the root directory of your project. In this case you need to install that version by nodist local XXX where XXX is the version of the node in .node-version file.
In my case, the problem was that I had a node version specified in my code repo that didn't match the node version installed on my machine. I needed the updated node version on my machine, so
I opened file explorer to the root of my repo.
I opened .node-version and edited the version number to the updated version I needed.
npm cache clean --force to start with a fresh cache. (Note: Others have said that npm cache clean --force is outdated, but this command worked for both my teammate and for me using npm version 6.9.0.)
npm install to reinstall my node modules.
npm run build and I had a clean build. Yay!
For Node 18 and npm 8.19.1, I found the advice at https://github.com/nullivex/nodist/issues/252#issuecomment-1170897428 useful.
I was getting cb.apply errors, and problems with #npmcli/arborist and libnpmfund, but I created those two links from the list.
I was using npx. This installs an old (v 5.8) version of npm inside its node_modules. That npm contains graceful-fs inside its node_modules. The cb.apply error was coming frome graceful-fs's polyfill.js.
I installed the latest version of graceful-fs, and copied the newer polyfill.js into the abovementioned (child of npm's) graceful-fs. This seemed to fix the problem for me.

How to avoid npm install/update surprises?

How to safely npm install/update when deploying/upgrading ?
Problem 1 : npm install is a statefull operation that depends on the latest versions of dependencies in the time when the command is executed. This causes surprises when deploying since package.json file indicates ranges but not specific versions.
Problem 2 : everytime I make npm update or use ncu, I spend hours/days trying to handle incoherences between modules. Why would this happens in 2018 ?
Problem 3 : How to have package.json file that describes exactly the state of installed packages instead of ranges so that I can deploy without surprises ?
NB: I use Angular
If you use yarn or a more recent version of npm, it will generate for you a yarn.lock or package-lock.json.
This will keep exactly the version of any package when it's first installed, so further calls to yarn or npm install will fetch and install exactly those versions.
Of course you should add these lock files to your repository so anyone doing a fresh clone get the same dependencies installed.
See the npm docs: https://docs.npmjs.com/files/package-lock.json
And the yarn docs: https://yarnpkg.com/lang/en/docs/yarn-lock/
package.json file indicates ranges but not specific versions : Re-read the documentation, you can specify specific versions. See point 3 for an example.
Why would this happens in 2018 <= I/we can't speculate as to problems where you did not include any specific details, it might be a valid general gripe you have but StackOverflow is not the correct place to vent it.
Again, see the documentation. You just have to include the version number with an = sign. Example below would get only the version 5.0.0 of #angular/cdk.
"#angular/cdk": "5.0.0"
be advised that any call to npm update will update your package.json with the latest minor version, so setting a strict constraint version ex (5.0.0) will only work with npm install when no package-lock.json is present. When doing npm update, your 5.0.0 constraint will be replaced by a ^5.5.0 constraint (or whatever the next minor release is). It's fine if the packages you are using implement semver correctly, but you can have a lot of issues with breaking changes on minor release.

npm and node versions incompatible can produce error

I've installed nodenv to manage versions of node and npm in my pc. Because when I try install packages like , angular-cli, webpack , typescript, angular2 and another, I get errors
FIRST QUESTION: Can an version node or npm produce error when i install a package?
Some packages tells things like: "The generated project has dependencies that require Node 4.x.x and NPM 3.x.x."
but they don't mention the exact version. by example Can a version of node 4.1.5 produce errors and not the version 4.0.5 ?
SECOND QUESTION:
I don't like these packages need be installed like global (-g) and the problems i see sometimes there are conflicts between global packages installed.
Example error:
npm WARN EPEERINVALID string-replace-loader#1.0.3 requires a peer of webpack#1.x.x || 2.x.x but none was installed.
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-macosx.zip
but what about if two global packages use same global package, but some of they use a different version for every package?
Its up to npm package owners to define in their package.json all the upstream dependencies with a set of working versions which play well together ... challenge is as a package owner to make your package.json loose as possible regarding upstream dependencies to enable pulling in newer releases of these dependent packages yet tight enough that your published package still works
Often this is not the case which can lead to version mismatch invoked errors ... if possible always use most recent package releases this goes for nodejs itself as well
When package.json mentions versions such as 3.x.x it means it should work with any value of x.x so just chose the highest number to fit the pattern
Where possible avoid doing a global install unless it is for command line executables ... this is especially true for packages which your code pulls in as opposed to an executable centric package
UPDATE I am now able to successfully install this
npm install -g angular-cli
using the latest release of node
node --version
v6.5.0
so I suggest you upgrade your own project code and node version to avoid that pinned release which fails and work with the most current releases

Satellizer installation error in windows

I am trying to install Satellizer.
But getting error.
Can you guide me to understand whats this error is, and how can I fix this.
I have node version v5.1.0 and npm version 3.5.2
Looks like you have the Satellizer as a decency inside your package.json
Or
That the project name is the same of one your depended package(s)
If it not a depended package, there used to be some error with npm v3.5.X so try to update your npm version and then re-install it.
I would also recommend to test it with node v4.X since v5 might contain those kind of bugs

Resources