npm scoped packages and private registry - angularjs

Our company has set up a private npm registry for our packages. We are trying to set up an angular2 application and all angular packages that are included (from the angular2 tutorial page) are scoped. The issue is while npm is set to our private registry, an npm install gives us this error message:
npm ERR! Linux 4.4.8-boot2docker
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v4.3.0
npm ERR! npm v2.14.12
npm ERR! code E404
npm ERR! 404 no such package available : #angular/core
npm ERR! 404
npm ERR! 404 '#angular/core' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'search-ui'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/npm-debug.log
If I set it to the default npm registry, angular2 pulls fine but obviously fails when trying to download the private package.
I haven't determined whether this is an overall angular2 thing (some permissions in the package manager) or just all scoped packages (not sure what other scoped packages exist). I have, however, tried all kinds of things to get the full set of packages to install to no avail (such as using a git repo instead of a package version which works in only specific cases which is not acceptable). And this error comes when I try to deploy this into either a Docker container or run locally (mostly concerned about the container case).
Has anyone else ever run into this problem? As well I apologize if this a bit vague so feel free to post a comment if more information is needed.

As NPM says in the documentation, all private packages are scoped, and scopes can be associated to custom registries.
So, if your private package is #myPrivateScope/aPrivatePackage, your problem could be solved by adding the following line to the .npmrc file on the root of your project:
#myPrivateScope:registry=http://my.private.registry.com
Where the url after the equals sign is the address to your private registry.
You can find other ways to do this association and more information about it on https://docs.npmjs.com/misc/scope#associating-a-scope-with-a-registry

Related

how to publish a react js website on gitlab

i created a static react js project and i pushed it to git-lab excluding node modules. But now i am not able to publish my website it is showing deploy failed. but the build was successful. i know that i should make some changes to packagejson file but i dont know what all changes to be done. kindly please guide me in this issue
npm ERR! npm bugs my-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /builds/Adithyets/react-website/npm-debug.log
Cleaning up file based variables
ERROR: Job failed: exit code 1

Error 404 when trying to create a new React app

I get this error while trying to create a new React app. Installing other components works fine.
Tried all the other posts on StackOverflow. Changed the connection too. Still doesn't work.
Thanks :)
C:\Users\ASUS\Desktop\reactproject1>npx create-react-app myapp
Creating a new React app in C:\Users\ASUS\Desktop\reactproject1\myapp.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/error-ex
npm ERR! 404
npm ERR! 404 'error-ex#^1.3.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'parse-json'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ASUS\AppData\Roaming\npm-cache\_logs\2020-02-12T07_33_08_955Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting myapp/ from C:\Users\ASUS\Desktop\reactproject1
Done.
https://registry.npmjs.org/error-ex is down in South Asian region for some reason, which is the cause of the issue.
If you have a VPN connection, Try connecting to US region. Or wait till it gets back online. :)

How develop node modules locally using npm link in react project

I want to add my custom build botframework-webchat in reactproject
I have tried adding using npm link.I get the following Error
Vostro-270s:~/React/Botframework webchat/chatbot$ npm link ./BotFramework-WebChat-3
npm ERR! code EINVALIDTYPE
npm ERR! typeerror Error: Argument #2: Expected array but got string
npm ERR! typeerror at EventEmitter.install (/usr/local/lib/node_modules/npm/lib/install.js:190:3)
npm ERR! typeerror at Object.commandCache.(anonymous function) (/usr/local/lib/node_modules/npm/lib/npm.js:156:13)
npm ERR! typeerror at /usr/local/lib/node_modules/npm/lib/link.js:93:24
npm ERR! typeerror at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:282:31
npm ERR! typeerror at FSReqWrap.oncomplete (fs.js:152:21)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /home/.npm/_logs/2019-07-16T11_35_13_546Z-debug.log
I have My BotFramework-WebChat-3 and My React app in a folder.
I'm tring to integrate Microsoft Botframework in my react app.
https://github.com/microsoft/BotFramework-WebChat
* Hard: In your React website, incorporate a custom build of the Web Chat component *
The simplest approach is to clone (or fork) this repo, alter it, build it, then reference your local build in your project's package.json as follows:
dependencies: {
...
'botframework-webchat': 'file:/path/to/your/repo'
...
}
Running npm install will copy your local repo to node_modules, and import/require references to 'botframework-webchat' will resolve correctly.
You may also wish to go so far as to publish your repo as its own full-fledged, versioned npm package using npm version and npm publish, either privately or publicly.
Different projects have different build strategies, yours may vary considerably from the above. If you come up with a different integration approach that you feel would have broad application, please consider filing a pull request for this README.
try run npm link /path/to/your/repo and don't forget to remove node_modules from your custom repo

Could not find a declaration file for module 'react-bootstrap-table-next'

I'm trying to run 'react-bootstrap-table-next' with my reactjs app. I'm having a problem
root#ubuntu:/home/rin/sc-deal/client# npm install #types/react-bootstrap-table-next
root#ubuntu:/home/rin/sc-deal/client# npm install #types/react-bootstrap-table-next
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#types%2freact-bootstrap-table-next - Not found
npm ERR! 404
npm ERR! 404 '#types/react-bootstrap-table-next#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-06-24T12_58_36_545Z-debug.log
root#ubuntu:/home/rin/sc-deal/client#
also error in my app because of it:
react-bootstrap-table-next doesn't exist in the #types scope.
You should instead use react-bootstrap-table.
npm install --save #types/react-bootstrap-table
I got the same issue in my project.
When I installed this package first time i used below command.
$ yarn add #types/react-bootstrap-table-next
It did not work. so i removed it and re-installed it with below command.
$ yarn add react-bootstrap-table-next #types/react-bootstrap-table-next
This worked fine for me. In my project i used typescript.
Refer this link also if it is useful: https://github.com/react-bootstrap-table/react-bootstrap-table2/issues/989

npm won't create a symlink for webdriver-manager while using JHipster DevBox

I'm trying to use JHipster with the DevBox at work, so with a proxy.
I think I have everything configured accordingly, but I still can't use JHipster properly.
I want to generate a microservice gateway with Protractor, but when I use yo jhipster or npm install, it gives me the following error:
> example-gateway#0.0.0 postinstall /home/vagrant/workspace/example/example-gateway
> webdriver-manager update
sh: 1: webdriver-manager: not found
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.12
npm ERR! Linux 3.13.0-88-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.4.5
npm ERR! npm v3.9.6
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! example-gateway#0.0.0 postinstall: `webdriver-manager update`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the example-gateway#0.0.0 postinstall script 'webdriver-manager update'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the example-gateway package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webdriver-manager update
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs example-gateway
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls example-gateway
npm ERR! There is likely additional logging output above.
And with sudo:
npm WARN lifecycle example-gateway#0.0.0~postinstall: cannot run in wd %s %s (wd=%s) example-gateway#0.0.0 webdriver-manager update /home/vagrant/workspace/example/example-gateway
However, I found webdriver-manager in the node_modules/protractor/bin directory, but npm seems to be unable to use it.
Actually, I already succeeded once in generating a microservice gateway with Protractor, but I don't know how: the error about webdriver-manager just disappeared one day. Indeed, there was several other errors (packages that didn't want to be installed), and running npm install over and over again while sometimes installing manually some packages seemed to fix them. However I'm trying to use JHipster on another computer so I need to know how to fix the webdriver-manager error.
I took a look in the node_modules folder of the completed gateway project, and discovered a webdriver-manager symlink inside .bin that wasn't in the same directory of the incomplete gateway project, so I supposed npm used it instead of the one in the node_modules/protractor/bin directory. I created one linking the two in the node_modules/.bin directory of the incomplete gateway project with ln -s ../protractor/bin/webdriver-manager webdriver-manager, and it apparently worked.
The problem is that I'm trying to make the installation and the configuration of the JHipster DevBox somehow automated, so people at work wanting to use it don't have to do it manually. If they have to remember to create a symlink each time they encounter that error, it won't be very practical.
Do you know why npm won't create that symlink himself (or sometime fails to install some packages), and how to fix it in a "clean" way?
Ok I found a solution, but I still don't know exactly why it does this and if their is a cleaner way to fix it.
http://perrymitchell.net/article/npm-symlinks-through-vagrant-windows/
I just replaced the node_modules directory by a symlink to somewhere inside the guest machine, so not in the shared folder with Windows. That way, I skip all the problems caused by Windows. The downside is I have to create the link before generating any project, and to fix that link and download again all the dependencies each time I update the DevBox, because I need to destroy the DevBox to update it.

Resources