How to update the offline registry of verdaccio? - npm

I installed the verdaccio in windows 8 os and It's working well.
my problem started when I tried to update the npm-cache.
after the update version of package.json file, I use the npm install --registry="http://localhost:4873 command for update npm-cache.
when I exec above command, it's start to install the packages, But after a while, I encountered with errors:
or
when I add that package (e.g request#^2.88.0) in package.json=>dependencies, It's installed but I encountered with next error package and loop ...
I clean the catch with npm cache clean --force. and remove the C:\Users\xxx\AppData\Roaming\npm-cache folder physicsally and reinstall. But to no avail.
I use the verdaccio#^4.4.0.
npm version is 6.3.14.
node version is 12.14.0.
how to fix this problem?
UPDATE:
I did the following:
update veraccio to version 4.4.2.
set registry config npm config set registry http://registry.npmjs.com/.
clean cache with this command npm cache clean --force.
update npm globally with npm i -g.
set registry config npm config set registry http://localhost:4873/.
and run npm i.
much better and resolve above errors. but I have new error:
config.yaml:
storage: ./storage
plugins: ./plugins
web:
title: Verdaccio
auth:
htpasswd:
file: ./htpasswd
uplinks:
#npmjs:
#url: https://registry.npmjs.org/
packages: '#*/*':
access: $all
publish: $all
unpublish: $all
#proxy: npmjs
'**':
access: $all
publish: $all
unpublish: $all
#proxy: npmjs
server: keepAliveTimeout: 60
middlewares: audit:
enabled: true
logs:
- { type: stdout, format: pretty, level: http }
package.json:
{
"name": "AngularModules",
"version": "2.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "node package-builder",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#agm/core": "^1.1.0",
"#angular/animations": "^6.1.4",
"#angular/cdk": "^7.3.7",
"#angular/common": "^6.1.10",
"#angular/compiler": "^6.1.10",
"#angular/core": "^6.1.10",
"#angular/flex-layout": "^6.0.0-beta.17",
"#angular/forms": "^6.1.10",
"#angular/http": "^6.1.10",
"#angular/material": "^6.4.7",
"#angular/platform-browser": "^6.1.10",
"#angular/platform-browser-dynamic": "^6.1.10",
"#angular/router": "^6.1.10",
"#aspnet/signalr": "^1.1.4",
"#asymmetrik/ngx-leaflet": "^4.0.0",
"#ngu/carousel": "^1.5.5",
"#ngx-loading-bar/core": "2.1.2",
"#ngx-loading-bar/router": "2.1.2",
"#ngx-prism/core": "^2.0.1",
"#ngx-translate/core": "^10.0.2",
"#ngx-translate/http-loader": "^3.0.1",
"#swimlane/ngx-datatable": "^13.1.0",
"#types/prismjs": "^1.16.0",
"angular-calendar": "^0.25.2",
"angular-material-fileupload": "0.0.11",
"angular-tree-component": "^7.2.1",
"buffer": "^5.4.3",
"chart.js": "2.7.2",
"core-js": "^2.6.11",
"d3": "^5.15.0",
"devextreme": "18.1.5",
"devextreme-angular": "18.1.5",
"dragula": "3.7.2",
"events": "^3.1.0",
"hammerjs": "2.0.8",
"intl": "1.2.5",
"jszip": "3.1.5",
"leaflet": "^1.6.0",
"lodash-es": "^4.17.15",
"material-design-icons": "^3.0.1",
"moment": "^2.24.0",
"ncp": "^2.0.0",
"ng-animate": "^0.3.4",
"ng2-charts": "1.6.0",
"ng2-dragula": "^2.1.1",
"ng2-file-upload": "1.3.0",
"ng2-jalali-date-picker": "^2.2.7",
"ng2-pdfjs-viewer": "^0.2.29",
"ng2-validation": "4.2.0",
"ng6-breadcrumbs": "1.0.7",
"ngx-export-as": "^1.4.0",
"ngx-perfect-scrollbar": "^6.3.1",
"ngx-quill": "^3.6.0",
"primeicons": "^1.0.0",
"primeng": "^6.1.7",
"print-js": "^1.0.63",
"prismjs": "^1.19.0",
"rxjs": "^6.2.2",
"rxjs-compat": "^6.2.2",
"screenfull": "3.3.2",
"stream": "0.0.2",
"timers": "^0.1.1",
"webpack-bundle-analyzer": "^2.13.1",
"zone.js": "^0.8.29"
},
"devDependencies": {
"#angular-devkit/build-angular": "^0.7.5",
"#angular-devkit/build-ng-packagr": "^0.7.5",
"#angular/cli": "^6.2.9",
"#angular/compiler-cli": "^6.1.10",
"#angular/language-service": "^6.1.10",
"#schematics/angular": "0.8.9",
"#schematics/update": "0.8.9",
"#types/jasmine": "^2.8.16",
"#types/jasminewd2": "^2.0.8",
"#types/node": "^10.5.8",
"codelyzer": "~4.4.4",
"jasmine-core": "~3.1.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.4",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^2.0.6",
"karma-jasmine": "^1.1.2",
"karma-jasmine-html-reporter": "^1.5.1",
"ng-packagr": "^3.0.0",
"node-sass": "^4.13.1",
"protractor": "^5.4.2",
"sass-loader": "^7.3.1",
"ts-node": "~7.0.1",
"tsickle": "^0.38.0",
"tslib": "^1.10.0",
"tslint": "~5.11.0",
"typescript": "^2.9.2"
}
}
any opinion?

The reason you are running into errors is that those packages do not exist in your local verdaccio, but on the regular npm registry.
You could solve this by either:
setting the regular npm registry as an uplink
set a scope for your registry by running npm config set #<scope>:registry <your verdaccio>
now all packages that start with #<scope>/ will be fetched from you verdaccio, but all others will be fetched from npm.

Related

Fontawesome giving 401 unauthorized error during build process

I've been using fontawesome with no issues for months. Today, I started seeing this error whenever I tried to push my app to production.
error An unexpected error occurred: "https://npm.fontawesome.com/#fortawesome/fontawesome-pro/-/6.1.1/fontawesome-pro-6.1.1.tgz: Request failed \"401 Unauthorized\"".
I've tried running yarn install, removing node_modules, removing yarn.lock, etc. and I still get 401 unauthorized. I even uninstalled and reinstalled all fontawesome packages.
I'm using Yarn, not NPM, so not sure if that has something to do with it. I do have a .npmrc file set up and that looks like:
// .npmrc
#fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken="my-token"
I also have a .yarnrc.yml file
// .yarnrc.yml
npmScopes:
fortawesome:
npmRegistryServer: "https://npm.fontawesome.com/"
npmAlwaysAuth: true
npmAuthToken: "my-token"
Here's my package.json:
{
"name": "br-client",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"test": "jest",
"storybook": "start-storybook -p 6006 --quiet",
"build-storybook": "build-storybook",
"storybook:clean": "rm -rf node_modules/.cache/storybook",
"json-server": "json-server -p 5000 --host 0.0.0.0 --watch db.json",
"compile": "tsc --noEmit"
},
"dependencies": {
"#auth0/auth0-react": "^1.3.0",
"#fortawesome/fontawesome-common-types": "^6.1.1",
"#fortawesome/fontawesome-pro": "^6.1.1",
"#fortawesome/fontawesome-svg-core": "^6.1.1",
"#fortawesome/free-brands-svg-icons": "^6.1.1",
"#fortawesome/free-regular-svg-icons": "^6.1.1",
"#fortawesome/free-solid-svg-icons": "^6.1.1",
"#fortawesome/react-fontawesome": "^0.1.18",
"#joeattardi/emoji-button": "^4.6.0",
"#stripe/react-stripe-js": "^1.4.1",
"#stripe/stripe-js": "^1.15.2",
"#tailwindcss/forms": "^0.4.0",
"#typeform/embed": "^1.2.0",
"#types/auth0-js": "^9.14.2",
"#types/lodash-es": "^4.17.4",
"#types/react-dom": "^17.0.0",
"#types/react-modal": "^3.12.0",
"algoliasearch": "^4.9.3",
"auth0-js": "^9.19.0",
"axios": "^0.21.1",
"classnames": "^2.2.6",
"date-fns": "^2.16.1",
"firebase": "^8.2.4",
"lodash-es": "^4.17.20",
"next": "10.0.5",
"next-transpile-modules": "^6.0.0",
"qs": "^6.9.6",
"rc-slider": "^9.7.1",
"rc-switch": "^3.2.2",
"react": "17.0.1",
"react-datepicker": "^3.4.1",
"react-dom": "17.0.1",
"react-easy-crop": "^3.3.2",
"react-functional-select": "^2.9.5",
"react-ga": "^3.3.0",
"react-helmet": "^6.1.0",
"react-hotjar": "^5.0.0",
"react-modal": "^3.12.1",
"react-player": "^2.9.0",
"react-query": "^3.5.16",
"react-typeform-embed": "^0.2.1",
"react-window": "^1.8.6",
"recoil": "^0.1.2",
"sharp": "^0.30.3",
"styled-components": "^5.2.1",
"styled-jsx-plugin-postcss": "^4.0.0"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#next/bundle-analyzer": "^10.0.5",
"#storybook/addon-actions": "^6.1.18",
"#storybook/addon-essentials": "^6.1.18",
"#storybook/addon-links": "^6.1.18",
"#storybook/react": "^6.1.18",
"#tailwindcss/postcss7-compat": "^2.0.3",
"#testing-library/jest-dom": "^5.11.8",
"#testing-library/react": "^11.2.3",
"#types/node": "^14.14.20",
"#types/react": "^17.0.0",
"#types/react-datepicker": "^3.1.7",
"autoprefixer": "^10.4.4",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.2",
"husky": "^5.1.3",
"import-sort-style-module": "^6.0.0",
"jest": "^26.6.3",
"json-server": "^0.16.3",
"lint-staged": ">=10",
"postcss": "^8.4.12",
"prettier": "^2.2.1",
"prettier-plugin-import-sort": "^0.0.6",
"tailwindcss": "^3.0.23",
"tsconfig-paths-webpack-plugin": "^3.3.0",
"typescript": "^4.1.3"
},
"importSort": {
".js, .jsx, .ts, .tsx": {
"style": "module",
"parser": "typescript"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "tsc --noEmit"
}
},
"lint-staged": {
"*.{js,jsx,ts,tsx,css,scss,md,json}": "prettier --write"
}
}
Answering my own question. The issue ended up being with my dockerfile. According to the fontawesome installation instructions you need to run these two commands in your terminal:
npm config set "#fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" "your token here"
But, if you use docker you'll need to add these two commands to your dockerfile:
RUN npm config set "#fortawesome:registry" https://npm.fontawesome.com/
RUN npm config set "//npm.fontawesome.com/:_authToken" "your token here"
That way, the config gets set when you deploy.
So my whole dockerfile now looks like...
FROM node:14-alpine
WORKDIR /usr/src/app
RUN npm config set "#fortawesome:registry" https://npm.fontawesome.com/
RUN npm config set "//npm.fontawesome.com/:_authToken" "my token"
COPY package*.json ./
COPY yarn.lock ./
RUN yarn install
COPY . .
RUN yarn build
EXPOSE 3000
CMD [ "yarn", "start" ]

Unmet Peer dependency warning even after installing the peer dependency

I'm trying to add redux to an Ionic 3+ application. This is what I ran:
npm i redux #angular-redux/store flux-standard-action redux-logger --save
I get the following error: UNMET PEER DEPENDENCY redux#4.0.1
So, I then completed the following steps to try to rectify the issue:
rm -rf node_modules/
npm cache clean
npm install redux#4.0.1 --save
This gives me the same err: UNMET PEER DEPENDENCY redux#4.0.1
How can it be a dependency of itself? Something weird is going on. I've tried rearranging where in the package.json the listing falls, to no avail. Help please. Below is my package.json
{
"name": "ionic-testing-elite-ionic",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"test": "karma start ./test-config/karma.conf.js",
"test-ci": "karma start ./test-config/karma.conf.js --single-run",
"e2e-update": "webdriver-manager update --standalone false --gecko false",
"e2e-test": "protractor ./test-config/protractor.conf.js",
"e2e": "npm run e2e-update && npm run e2e-test"
},
"dependencies": {
"#angular-redux/store": "^7.1.1",
"#angular/common": "5.0.0",
"#angular/compiler": "5.0.0",
"#angular/compiler-cli": "5.0.0",
"#angular/core": "5.0.0",
"#angular/forms": "5.0.0",
"#angular/http": "5.0.0",
"#angular/platform-browser": "5.0.0",
"#angular/platform-browser-dynamic": "5.0.0",
"#ionic-native/core": "3.12.1",
"#ionic-native/splash-screen": "3.12.1",
"#ionic-native/status-bar": "3.12.1",
"#ionic/storage": "2.1.3",
"flux-standard-action": "^2.0.3",
"ionic-angular": "^3.9.2",
"ionicons": "3.0.0",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "3.1.0",
"#types/jasmine": "^2.5.41",
"#types/node": "^7.0.8",
"angular2-template-loader": "^0.6.2",
"html-loader": "^0.4.5",
"ionic": "3.9.2",
"jasmine": "^2.5.3",
"jasmine-spec-reporter": "^4.1.0",
"karma": "^1.5.0",
"karma-chrome-launcher": "^2.0.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"null-loader": "^0.1.1",
"protractor": "^5.1.1",
"ts-loader": "^2.0.3",
"ts-node": "^3.0.2",
"typescript": "2.4.2"
},
"version": "0.0.1",
"description": "An Ionic project"
}
OK. I read some more into the error I was getting. The problem was that the current redux package which was being installed by default was not compatible with the version of #angular-redux/store which was being installed. There has been a major version upgrade to redux which isn't backwards compatible. I had to install redux#3.7.2 and it fixed the problem.

Angular - error TS2307: Cannot find module 'ngx-bootstrap/modal'

I have installed ngx-bootstrap using the command npm install ngx-bootstrap --save but still when i am trying to build the solution it says
ERROR in src/app/app.module.ts(37,45): error TS2307: Cannot find module 'ngx-bootstrap/modal'.
I have checked in the node_modules folder ngx-bootstrap/modal is present there.
here is my package
{
"name": "test-app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^5.1.0",
"#angular/common": "^5.1.0",
"#angular/compiler": "^5.1.0",
"#angular/core": "^5.1.0",
"#angular/forms": "^5.1.0",
"#angular/http": "^5.1.0",
"#angular/platform-browser": "^5.1.0",
"#angular/platform-browser-dynamic": "^5.1.0",
"#angular/router": "^5.1.0",
"#ng-select/ng-select": "^1.6.3",
"#ngx-translate/core": "^9.1.1",
"#ngx-translate/http-loader": "^2.0.1",
"angular2-jwt": "^0.2.3",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"intl": "^1.2.5",
"jquery": "^3.3.1",
"moment": "^2.22.2",
"ng2-select2": "^1.0.0-beta.16",
"ngx-bootstrap": "^3.1.2",
"ngx-drag-and-drop-lists": "1.1.3",
"ngx-logger": "^3.1.0",
"ngx-moment": "^3.1.0",
"ngx-mydatepicker": "^2.4.9",
"rxjs": "^5.5.6",
"zone.js": "^0.8.19"
},
"devDependencies": {
"#angular/cli": "^1.5.6",
"#angular/compiler-cli": "^5.1.0",
"#angular/language-service": "^5.1.0",
"#types/jasmine": "~2.8.3",
"#types/jasminewd2": "~2.0.2",
"#types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage": "^1.1.2",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-junit-reporter": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.4",
"node-sass": "^4.9.0",
"phantomjs": "^2.1.7",
"protractor": "^5.3.2",
"ts-node": "~3.2.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}
can anyone please help
Try using this npm install ngx-bootstrap#2.0.5 --save it might work!
I spent almost one day to solve this issue. please go with this solution.
Run "npm install ngx-bootstrap --save" and then Run "npm install"
It will automatically solve this problem and your application will run.

Npm not running a custom script

When I run ng build && node server.js from the same directory, everything is ok.
When I run npm build this is my result:
C:\Users\Admin\Desktop\mean-darts-app>npm build
C:\Users\Admin\Desktop\mean-darts-app>
{
"name": "dart-app",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"build": "ng build && node server.js",
"ng": "ng",
"start": "ng serve",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"#angular/common": "^2.3.1",
"#angular/compiler": "^2.3.1",
"#angular/core": "^2.3.1",
"#angular/forms": "^2.3.1",
"#angular/http": "^2.3.1",
"#angular/platform-browser": "^2.3.1",
"#angular/platform-browser-dynamic": "^2.3.1",
"#angular/router": "^3.3.1",
"axios": "^0.16.2",
"body-parser": "^1.17.2",
"core-js": "^2.4.1",
"express": "^4.15.3",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"#angular/compiler-cli": "^2.3.1",
"#types/jasmine": "2.5.38",
"#types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.28.3",
"codelyzer": "~2.0.0-beta.1",
"jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "~4.0.13",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.3"
}
}
For custom scripts you need to use:
npm run script_name
or
npm run-script script_name
Look into your server.js file, do you have a server.listen statement on it? No output only means "I've finished executing this program with no errors".

npm downloading hundreds of packages?

I'm working on an Angular2 (currently on RC1) project in Visual Studio 2015; and straining my understanding of NPM.
Looking in the Dependencies/npm folder, and /node_modules there are hundreds of npm packages. Most of which are labeled as extraneous by Visual Studio (in Dependencies/npm)
I went through and removed all the extraneous packages manually (npm prune did nothing).
I apparently accidentally removed a non-extraneous package, which I attempted to restore. NPM went ahead and re-downloaded all 500+ extraneous packages again...
What am I missing?
My package.json:
{
"name": "MySite",
"version": "0.0.1",
"description": "My Site",
"repository": "./src",
"license": "UNLICENSED",
"dependencies": {
"#angular/common": "^2.0.0-rc.1",
"#angular/compiler": "2.0.0-rc.1",
"#angular/core": "^2.0.0-rc.1",
"#angular/http": "2.0.0-rc.1",
"#angular/platform-browser": "2.0.0-rc.1",
"#angular/router": "^2.0.0-rc.1",
"es6-promise": "3.1.2",
"es6-shim": "0.35.0",
"jquery": "2.2.2",
"jquery-validation": "1.15.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"zone.js": "^0.6.12"
},
"devDependencies": {
"gulp": "3.9.1",
"gulp-cssmin": "0.1.7",
"gulp-concat": "2.6.0",
"gulp-sass": "2.3.1",
"typings": "0.8.1",
"typescript": "^1.8.10",
"null-loader": "^0.1.1",
"raw-loader": "^0.5.1",
"style-loader": "^0.13.1",
"ts-loader": "^0.8.1",
"webpack": "1.13.0",
"webpack-dev-server": "1.14.1",
"webpack-merge": "0.12.0"
},
"scripts": {
"postinstall": "typings install"
}
}