Issues changing npm registry [duplicate] - javascript

This question already has answers here:
Override registry for installed packages in package-lock.json
(4 answers)
Closed 4 months ago.
I have a Vue 2.7 project with vuetify installed. First, I install dependencies using a custom local npm registry, which is a proxy to npm default, now the project is growing and I'm using git actions to deploy for a development server, or at least I'm trying to.
When GitHub actions try to npm install it uses package-lock.json with my registry configured, and of course can't find it, if I delete my package-lock.json or set package-lock to false before install, it returns a lot of warns and error since packages dependencies are outdated.(this happens even when I use specific versions on package.json)
My questions are.
How can I update the npm registry for all my package-lock.json tree of dependencies in order to maintain the right version for every one of them?
Is there any other solution?

See my answer on a related question:
Find/replace registry in package-lock
Delete node_modules
Verify npm install works

Related

The react-scripts package provided by Create React App requires a dependency: "babel-eslint": "^10.1.0" dont install it manually [duplicate]

This question already has answers here:
'npm start' returns error: "There might be a problem with the project dependency tree"
(24 answers)
Closed 12 months ago.
PS C:\Users\joshm\Downloads\SMARTcontract\~\metaplex\js\packages\candy-machine-ui> yarn start
yarn run v1.22.17
$ react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-eslint": "^10.1.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-eslint was detected higher up in the tree:
C:\Users\joshm\node_modules\babel-eslint (version: 10.0.1)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "babel-eslint" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if C:\Users\joshm\node_modules\babel-eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls babel-eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-eslint.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Create a .env file in your project directory, and add the following code:
SKIP_PREFLIGHT_CHECK=true
Then, remove the node_modules folder, yarn.lock file and reinstall your node modules with
npm install

Getting npm WARN deprecated

I am getting following npm WARN deprecated although these packages are not in package.json file. Where these packages are listed? and where should i change their versions?
npm WARN deprecated fsevents#1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
npm WARN deprecated core-js#2.6.10: core-js#<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
If these packages are not in your package.json, then they must be in package-lock.json which maintains the dependencies of dependencies mentioned in your package.json .
You can simply update the packages which are giving warning. Or maybe you can suppress these warning messages, npm gives various options to do it. Have a look at this.
These packages are not listed because they are dependencies of other packages that you use, they are not in your json file but some of the packages that are using them need them.
I don't think you have any problems updating them, but I recommend saving your status anyway. You can update your project on github up to this point, and if something happens with the update you can always go back to the previous point.

Change package.json to whats in node_modules [duplicate]

This question already has answers here:
Build Package.Json From Existing Node_Modules Folder?
(3 answers)
Closed 3 years ago.
I just got a project that someone else has been working on. When I copied it I have to copy the node_modules folder or it doesn't work. Is there a way to have the package.json be updated based on whats in the node_modules directory?
These two steps are backwards. node_modules/ should not be checked into Git or shared from one computer to another. It's just a representation of what's in package.json. That file, not the directory, is the source of truth for your JavaScript dependencies. If that's not the case on your project, you'll have to fix that first to do any work on it.
First, remove node_modules:
$ rm -rf node_modules
Or, per rcdmk's answer, rename it so you have a reference of what was there:
$ mv node_modules node_modules_backup
Then, recreate it from package.json with your CLI tool of choice:
$ npm install # npm
$ yarn install # yarn
Finally, work through any issues in the code caused by the new dependencies. These will show as errors up in your server log, browser console, or build output. If you created a node_modules_backup, compare the subdirectories there to your new node_modules to see what's missing.
As others pointed out, the issue is already there and one way of dealing with it is to rename the node_modules folder, run npm install or yarn install and then try executing the application and figuring out the missing dependencies.
You can have an easier picture of what is missing if you run a tree command in the old node_modules and compare to a tree command output from the new one. You wouldn't need to add all differences, just the top level ones.
Instead of tree you can ls -1 (or dir /d /b if on Windows).
In npm it's package.json that generates node_modules, not the other way around. You should get the package.json with all the dependencies and run npm install

Excluding NPM dependencies on a per-package basis

I have a package (d3.js) in my package.json for a given project. When npm install is run for the project, I would like npm not to install any dependencies related to d3.js itself, nor run any install scripts for it. In other words, I would like npm to just fetch the package and unpack it into node_modules so that it can still be accessed as a regular package, but not do anything else with it.
My reason for this is that a regular npm install for this particular package requires node-gyp to be run, and the build pipe I have to use (not under my control) does not support any kind of native compilation, hence the install fails. However, the package already includes pre-compiled .js files, which are the only things I am interested in, and hence the install process is not even necessary.
Is this at all doable?
After a lot of searching, the answer is no. It does not seem like this is a planned feature for NPM either, nor could I find it provided by Yarn (which I am now using instead).

Point to a Local git package on bower, with specific branch [duplicate]

This question already has answers here:
Specifying latest revision of a particular branch with bower
(3 answers)
Closed 9 years ago.
I'm trying to figure out some things in bower but am having some issues. Mainly, when I try and install a locally hosted repo's specific branch.
For instance, I run this command:
bower install appName=/path/to/file
However, when I do that, I get:
ENORESTARGET Tag/branch master does not exist
Additional error details:
Available tags: some-tag-1,
Available branches: integration, origin/bower
I'm specifically trying to get to the 'orgin/bower' branch. Can anyone help?
The correct syntax would be:
bower install appname=/path/to/file#bower
Make sure the path is valid and that it points to a git repo which contains a bower branch.
Also note that appname should be lowercase.

Categories