I'm trying to install a package that exists on our private repo. The goal is to share the repo with a partner, but I need to make sure they can install it. In theory, it should work, but none of the documented solutions are working for me
I've tried adding the package to the package.json file
"dependencies": {
"package_name": "git+https://<deploy-token-name>:<deploy-token>#gitlab.domain.com/group/repo.git"
}
And then installing with npm but it seems to fail on the deploy token, but it's hard to say because the log isn't very helpful and then our whole gitlab deployment goes down for a moment #fun
29 error
29 error undefined
29 error exited with error code: 128
I've also tried with a private access token
"package-name": "https://oauth2:<access-token>#gitlab.domain.com/group/repo.git"
This results in an actual error that I can understand, except the error is saying there isn't a package.json in the repository, but there most certainly is
npm ERR! package.json Non-registry package missing package.json: package-name#https://oauth2:<access-token>#gitlab.domain.com/group/repo.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
I've tried with ssh (with a ssh key setup that works for commits etc)
git+ssh://git#my-domain.com:my-project/my-repo#my-branch
And that results in an error
npm ERR! premature close
I've read through a dozen related issues and articles, but nothing is working for me
Install npm module from gitlab private repository
Install npm module from gitlab private repository
Use dependencies from a private GitLab with NPM
https://hackernoon.com/private-npm-packages-2e6579b37616
I've got the same issue and I managed to fix it.
The gitlab repository that I wanted to install didn't have a package.json file.
Check dependency package.json
On npm install, the error npm ERR! premature close seems common if there's any problems with depency package.json's...
Does a package.json exist?
Is everything inside absolutely correct?
Everything ok with dependencies dependencies?
In my case, I had an illegal version number ("1" instead of "1.0.0"). This was not an issue on my local environment, but only when deploying to remote production. Fixing this cleared the error right away.
For reference this is my dependency line:
"myCustomRepo" : "git+https://MyGithubUsername:MyGithubPublicAccessToken#github.com/MyGithubUsername/myCustomRepo"
You should use Scopes if you want to install private npm packages.
You can define a scope in .npmrc file of your repository.
example .npmrc in your application repo:
#scopeName:registry=http://private-npm-registry/
always-auth=true
So npm can handle a dependency like:
#scopeName/yourprivateModule#version
The token to access this repo should not be included in your Repository in should be configured in your home folders .npmrc .
Npm will first look in ther current folder for a .npmrc and later in your home folder. The configured options will be merged.
But this approach is only good for you if you publish your package to a private npm registry.
https://docs.gitlab.com/ee/user/project/packages/npm_registry.html#authenticating-with-an-oauth-token
So to summarize this:
configure your scope in a .npmrc file of your repository
configure access token in .npmrc file of your environment user
add scoped dependency to your package.json
e.g.
npm i #scopeName/yourprivateModule#version
Related
When i ran npm start command to start server for my react app created using npx create-react-app my-app, The following error is occuring.Please help me with the solution to clear the following bug.I have also tried all the steps mentioned below by it but the error was not cleared.
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\LENOVO\node_modules\babel-eslint (version: 9.0.0)
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\LENOVO\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!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reactapp#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactapp#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\LENOVO\AppData\Roaming\npm-cache\_logs\2020-07-19T12_53_40_050Z-debug.log
create your application outside the Desktop folder.
This is because of the package versions installed in user directory. The line from the error mentions the overriding version in the global user directory.
C:\Users\LENOVO\node_modules\babel-eslint (version: 9.0.0)
Try updating the version in the node_modules folder in the user directory or remove these and maintain local node_modules based on each project requirements.
I found a possible solution, or at least this one worked well for me. npm install #babel/eslint-parser and then npm start . If this doesnt work, first try this:
Delete babel-eslint in your node-modules or
Search where you could find that one with npm ls babel-eslint,
I hope works for you. :)
I've tried to deploy my app to github but it kept showing me this in the terminal :
Cloning into 'node_modules\gh-pages.cache\gwenmengue.github.io!robofriends'...
fatal: repository 'https://gwenmengue.github.io/robofriends/' not found
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! robofriends#0.1.0 deploy: gh-pages -d build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the robofriends#0.1.0 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\AppData\Roaming\npm-cache_logs\2019-11-04T18_18_25_037Z-debug.log
I joined a screenshot of my package.json file by the way!: https://i.stack.imgur.com/FLTmm.jpg
Moreover when I was running the operations, I was in my project directory so I don't understand what wasn't working ?
Kindly guide me how to solve this issue. Thanks.
First, make sure you CAN push your project to github from your project folder. Your credentials, remote repo, etc need to be setup and working before the script will work.
Just in case you need help with this, see this github help page
If you are able to push your project successfully to Github from the same project folder your terminal command is in, then try building and running your commands again:
npm run build
npm run deploy
This gh-pages article on Medium might be helpful as well. Also, if you want to change any of your gh-pages variables (so you can deploy your static code to a different repository in case that's what you're trying to do), here's the project page for gh-pages.
I, for example, am deploying ONLY my static build directory to a completely different public repository in Github, while keeping my React project source files in a different private repository. Github doesn't allow you to host pages from private repositories unless you pay, so I just use two repositories :). In order to achieve this, in script area of my package.json, I added the following options to the gh-pages command in my deploy directive:
"deploy": "gh-pages -d build -r https://github.com/MyGitHubName/web.git -o web",
The -r option lets you enter a different repository url, and the -o option allows you to enter a different remote origin for deploying your code, in my case I named it "web" because that's the same name as my public repository on Github.
You can list all of your existing remotes with:
git remote -v
You would setup a different remote in your local git environment with:
git remote add YourNewRemoteName https://github.com/YOURGITHUBNAME/YOURPROJECTNAME
I apologize in advanced if this is all info you already know, but when I was having trouble deploying my project, I found all of this info useful. Cheers.
Below is the issue I am dealing with while I am starting the project with the command line 'npm 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:
"webpack": "4.28.3"
Don't try to install it manually: your package manager does it
automatically. However, a different version of webpack was detected
higher up in the tree:
/Users/sattys/node_modules/webpack (version: 4.29.0)
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:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
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:
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.
Check if /Users/sattys/node_modules/webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
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!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! jvm-configuration#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the jvm-configuration#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!
/Users/sattys/.npm/_logs/2019-04-04T12_30_29_925Z-debug.log
Have you tried the suggestion is the error message?
First Try:
To fix the dependency tree, try following the steps below in the exact order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
If that doesn't work try:
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.
Check if /Users/sattys/node_modules/webpack is outside your project directory. For example, you might have accidentally installed something in your home folder.
Try running npm ls webpack in your project folder. This will tell you which other package (apart from the expected react-scripts) installed webpack.
npm install terser#3.14
try installing this library,hope it should work
1)Ensure that you are running the same version of Node as the other system where it was seen running perfectly. You can test this by entering the following on your terminal and the terminal it was working on: node -v. If they're different, look to upgrade (or indeed downgrade) your installation.
2)Delete the node_modules and package-lock.json directory from the project root on your current computer, then run an npm install to ensure that the binaries that were compiled are compatible with your operating system.
I used create-react app to create a new react application, when I try to start it using the command npm start, it returns the following error:
> warbler-client#0.1.0 start
/mnt/c/Users/Debchakra/Desktop/warbler/warbler-client
> 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:
"webpack": "4.28.3"
Don't try to install it manually: your package manager does it
automatically.
However, a different version of webpack was detected higher up in the
tree:
/mnt/c/Users/Debchakra/node_modules/webpack (version: 4.29.5)
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 "webpack" 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 /mnt/c/Users/Debchakra/node_modules/webpack is outside your
project directory.
For example, you might have accidentally installed something in your
home folder.
7. Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected
react-scripts) installed webpack.
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!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! warbler-client#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the warbler-client#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/webdeb/.npm/_logs/2019-03-26T06_44_19_294Z-debug.log
I tried all the steps mentioned above, like install yarn and all that, but it always shows the same error.
Previously, I have used create-react-app inside if cloud9, it worked fine then, but now I am doing it on my local system. And I actually using WSL. (if that helps)
You already have a version of webpack installed globally on your system ( /mnt/c/Users/Debchakra/node_modules/webpack (version: 4.29.5)
) which does not match the version required by create-react-app.
Uninstalling the global version via npm uninstall -g webpack should fix it.
Here is my error page:
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:
"webpack": "4.19.1"
Don't try to install it manually: your package manager does it
automatically. However, a different version of webpack was detected
higher up in the tree:
C:\Users\Acer\node_modules\webpack (version: 4.28.3)
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:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
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:
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.
Check if C:\Users\Acer\node_modules\webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
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!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! first-app#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the first-app#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Acer\AppData\Roaming\npm-cache\_logs\2019-01-03T12_30_23_160Z-debug.log
I've applied all steps but, npm start command still doesn't work.
What should I do?
I got the solution! Focus on the point 6: it asks to delete node_modules folder outside your project directory.
So, I deleted my C:\Users\Acer\node_modules folder and npm start worked for me !!
It is due to the node module dependency conflict.
Delete the node_modules folder from C:\Users\Acer directory. It will resolve the issue.
I tested many ways including delete the node_modules folder but it didn't work , perhaps the best one is to delete the current version of node.js and reinstall it..it answered for me ,i hope it works for you too.
I solved this problem by switching from npm to yarn
Just delete the node_moduelsfolder and the package-lock.json file (not the package.json file). After that just try yarn to install all the packages and here you go.
installation for yarn:
https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable
In your case, C:\Users\ Delete any node_modules folders outside its parent projects folder in the directory folder. Worked for me.
must have to follow all these steps :
curl -sL https://deb.nodesource.com/setup_13.x -o nodesource_setup.sh #installation purpose.
sudo bash nodesource_setup.sh
sudo apt-get install nodejs -y
sudo apt update
sudo apt-get update
npm install -g create-react-app
create-react-app --version
create-react-app hello-react
happy coding!
I've created a .env file and then I added this command==> SKIP_PREFLIGHT_CHECK=true
to the .env file! It works for me!