Bug in bower-installer, can't find bower.json - json

Tired of bower downloading everything in each repo I install, I setup bower-installer.
https://scotch.io/tutorials/only-grab-the-files-you-need-while-using-bower
However after running bower-installer I get this strange error:
bower-installer
/usr/local/lib/node_modules/bower-installer/bower-installer.js:56
throw createError('Neither bower.json nor component.json present', 'ENOEN
My bower.json file is there, and what's in it below:
{
"name": "app",
"main": "app.js",
"version": "0.0.0",
"authors": [
"Leon"
],
"description": "My app",
"keywords": [
"tags",
"manage"
],
"license": "MIT",
"homepage": "me.com",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular-bootstrap": "~0.12.1",
"angular-loader": "1.2.x",
"angular-mocks": "~1.2.x",
"angular-route": "1.2.x",
"angular-scroll": "~0.6.5",
"chartist": "~0.7.3",
"bootstrap": "~3.3.4",
"angular": "~1.3.15"
},
"install": {
"path": "libs",
"sources": {
"angular": "bower_components/angular/angular.min.js",
"bootstrap": "bower_components/bootstrap/dist/js/bootstrap.min.js",
"chartist": [
"bower_components/chartist/dist/chartist.min.js",
"bower_components/chartist/dist/chartist.min.css",
],
"angular-scroll": "bower_components/angular-scroll/angular-scroll.min.js",
"angular-route": "bower_components/angular-route/angular-route.min.js",
"angular-mocks": "bower_components/angular-mocks/angular-mocks.js",
"angular-loader": "bower_components/angular-loader/angular-loader.min.js",
"angular-bootstrap": [
"bower_components/angular-bootstrap/ui-bootstrap-tpls.js",
"bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js",
"bower_components/angular-bootstrap/ui-bootstrap.js",
"bower_components/angular-bootstrap/ui-bootstrap.min.js"
]
}
}
}

Your bower.json is incorrect, this part
"chartist": [
"bower_components/chartist/dist/chartist.min.js",
"bower_components/chartist/dist/chartist.min.css",
],
should be
"chartist": [
"bower_components/chartist/dist/chartist.min.js",
"bower_components/chartist/dist/chartist.min.css"
],
So drop the last comma. That comma makes the json invalid and therefore the bower installer can't parse it. I verified this with your bower.json and it works fine after removing the comma.

Related

Composer dependency from own forked repository

I have gitlab repository https://gitlab.com/ajkosh/yii2-admin and below is my composer.json:
{
"name": "haruatari/yii2-module-app",
"description": "Empty module application on Yii2",
"minimum-stability": "stable",
"license": "MIT",
"authors": [
{
"name": "Viktor Pikaev",
"email": "haruatari#gmail.com",
"homepage": "http://haru-atari.com/about"
}
],
"repositories": [
{
"type": "vcs",
"url": "git#github.com:ajkosh/yii2-admin.git"
}
],
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "2.0.15",
"yiisoft/yii2-bootstrap": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0",
"paulzi/yii2-materialized-path": "^2.0",
"kartik-v/yii2-widget-select2":"2.0.4",
"ajkosh/yii2-admin": "dev"
},
"require-dev": {
"codeception/codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"fxp-asset": {
"installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
},
"process-timeout": 1800},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"data": "0777",
"data/log": "0777",
"data/tmp": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
}
}
}
I am trying to fetch yii2-admin from my own repository but I am getting below error when I am running composer update.
Problem 1
- The requested package ajkosh/yii2-admin could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
You're using incorrect package name. On resolving dependencies package name in URL is irrelevant, the only name what matters is package name in composer.json. So Composer reads composer.json from your forked repository, and finds name mdmsoft/yii2-admin, because you don't changed it after forking. There is no ajkosh/yii2-admin at all. You should either update package name in composer.json in your fork:
{
"name": "ajkosh/yii2-admin",
"description": "RBAC Auth manager for Yii2 ",
"keywords": ["yii", "admin", "auth", "rbac"],
"type": "yii2-extension",
...
Or use source package name in your require section:
"require": {
...
"mdmsoft/yii2-admin": "dev-master"
},

All vendor CSS are rendered as style tag in the top of html in Angular 4 application

In my Angular 4 project i have included Bootstrap, Fontawesome and some my own CSS but everything is rendering as tag in the top of my index.html. I expect all of them minimize and include as a bundle CSS in the file please refer the image attached for more clarification
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"project": {
"name": "test"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.css",
"../node_modules/font-awesome/css/font-awesome.min.css",
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/primeng/resources/themes/omega/theme.css"
],
"scripts": ["../node_modules/bootstrap/dist/js/bootstrap.min.js"],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
The css vendors are being added as style elements by the javascript bundle files .
You need to compile your application with the --extract-css options, which will create single .css files

Angular-cli SyntaxError: Unexpected token ]

I just pulled the new version of my project with git and angular-cli stopped working. When I start it, I get the following error:
Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token ] in JSON at position 1044
InvalidConfigError: Parsing .angular-cli.json failed. Please make sure your .angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token ] in JSON at position 1044
My angular-cli.json file is the following:
{
"project": {
"version": "1.0.0-beta.22-1",
"name": "quest"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.less",
"../node_modules/angular2-toaster/toaster.css",
"../node_modules/bootstrap-slider/dist/css/bootstrap-slider.min.css",
"../node_modules/bootstrap-timepicker/css/bootstrap-timepicker.css",
"../node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/bootstrap/dist/js/bootstrap.js",
"../node_modules/admin-lte/dist/js/app.js",
"../node_modules/bootstrap-slider/dist/bootstrap-slider.js",
"../node_modules/bootstrap-timepicker/js/bootstrap-timepicker.min.js",
"../node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
}
I tried updating angular-cli, I tried deleting node_modules et running npm install. I have node version 6.9.5. I tried parsing the angular-cli.json with some JSON validation tools.
Any other idea?

The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program

Please help me fix this issue. Below is my project.json file.
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.EntityFrameworkCore": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"imports": [ "portable-net45+win8+dnxcore50", "portable-net45+win8" ]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [ "dotnet5.6", "portable-net45+win8" ]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [ "wwwroot", "web.config" ]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
When I create a brand new project, and add the same project.json file to the project, "Add-Migration" command works perfect.
As I check on the internet, people talk about Restarting VS2015 , I have done it all and still the issue exists.
Have you tried running the Enable-Migrations command before your Add-Migration?
Or if that doesn't work, this answer seems to suggest reinstalling Entity Framework from Nuget

npm install that loads dependency with package.json as authored

I noticed that when viewing a package.json under node_modules, I see JSON that looks like:
{
"_args": [
[
"example#0.2.0",
"C:\\path\\to\\project\\folder"
]
],
"_from": "example#0.2.0",
"_id": "example#0.2.0",
"_inCache": true,
"_installable": true,
"_location": "/example",
"_nodeVersion": "6.2.0",
"_npmUser": {},
"_npmVersion": "3.8.9",
"_phantomChildren": {},
"_requested": {
"name": "example",
"raw": "example#0.2.0",
"rawSpec": "0.2.0",
"scope": "#edf",
"spec": "0.2.0",
"type": "version"
},
"_requiredBy": [
"/"
],
"_resolved": "http://internal.registry/example/-/example-0.2.0.tgz",
"_shasum": "b564b263db925ff3a8bffdc922c16f8e4b6f4641",
"_shrinkwrap": null,
"_spec": "example#0.2.0",
"_where": "C:\\path\\to\\project\\folder",
"author": {
"name": "NPM User"
},
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0"
},
"description": "Example Package",
"devDependencies": {},
"dist": {
"shasum": "b564b263db925ff3a8bffdc922c16f8e4b6f4641",
"tarball": "http://internal.registry/example/-/example-0.2.0.tgz"
},
"main": "index.js",
"name": "example",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"readmeFilename": "README.md",
"scripts": {
"postinstall": "gulp"
},
"version": "0.2.0"
}
Instead of just:
{
"name": "example",
"version": "0.2.0",
"description": "Example Package",
"main": "index.js",
"scripts": {
"postinstall": "gulp"
},
"author": "NPM User",
"dependencies": {
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.1.0"
}
}
Is there a command-line argument I can specify to keep dependency package.json files as authored when installing, or is there another way I can access the file as authored when there is no repository specified for the package?
I found an option called proprietary-attribs on the npm-config documentation but I don't think that's what I'm looking for.