I have this code in my webstorm IDE in the Terminal dialog:
bower install angular-ui-router
When I look now in my app/bower_components folder I can see the new created folder with angular-ui-router package.
But what I would have expected is also an entry in the bower.json file:
{
"name": "app",
"version": "0.0.0",
"dependencies": {
"angular": "1.2.6",
"json3": "~3.2.6",
"es5-shim": "~2.1.0",
"jquery": "~1.10.2",
"bootstrap": "~3.0.3",
"angular-resource": "1.2.6",
"angular-sanitize": "1.2.6",
"angular-route": "1.2.6",
"angular-bootstrap": "~0.10.0"
},
"devDependencies": {
"angular-mocks": "1.2.6",
"angular-scenario": "1.2.6"
}
}
I does not see the angular-ui-router anywhere!
Why is that?
You need to use the --save flag to get it in your bower.json:
bower install --save angular-ui-router
Related
I have an Angular 1.6 project which did build using:
node 10.16.0
bower 1.8.14
gulp 3.9.1
and with the command sequence:
npm install
bower install
gulp
It now breaks at the bower install step with the file-saver.js#~1.20150507.2 throwing error:
Failed to execute "git ls-remote --tags --heads https://github.com/Teleborder/FileSaver.js.git", exit code of #128
Because of this, I have removed the line
"angular-file-saver": "^1.1.3"
from the bower.json file (bower uninstall did not work for that package) and installed the angular-file-saver package via
npm install angular-file-saver --save-dev
So now the package.json looks like this:
{
"name": "app",
"version": "1.0.0",
"description": "app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"app"
],
"author": "me",
"license": "ISC",
"devDependencies": {
"angular-file-saver": "^1.1.3",
"del": "^2.2.2",
"eslint-config-angular": "^0.5.0",
"eslint-plugin-angular": "^1.5.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-angular-templatecache": "^2.0.0",
"gulp-autoprefixer": "^3.1.1",
"gulp-cheerio": "^0.6.2",
"gulp-clean-css": "^2.2.2",
"gulp-concat": "^2.6.1",
"gulp-eslint": "^3.0.1",
"gulp-filter": "^4.0.0",
"gulp-flatten": "^0.3.1",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-inject": "^4.1.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-rev": "^7.1.2",
"gulp-sass": "^3.0.0",
"gulp-sourcemaps": "^1.9.1",
"gulp-string-replace": "^0.3.1",
"gulp-uglify": "^2.0.0",
"main-bower-files": "^2.13.1",
"natives": "^1.1.6",
"require-dir": "^0.3.1",
"rimraf": "^2.6.2",
"stream-series": "^0.1.1",
"uglify-save-license": "^0.4.1",
"yargs": "^6.5.0"
},
"dependencies": {
"bower": "^1.8.4"
}
}
My src\app.js contains this:
(function(angular) {
'use strict';
angular
.module('app', [
'angular-cache',
'ui.router',
'ui.router.modal',
'ui.bootstrap',
'ui.bootstrap-slider',
'ui.validate',
'angular-confirm',
'ngAnimate',
'ngFileSaver',
'angularMoment',
'pascalprecht.translate',
'tmh.dynamicLocale']);
}(window.angular));
And my controller contains this:
angular
.module('app')
.component('readings', {
controllerAs: 'vm',
templateUrl: 'readings/readings.html',
controller: ReadingsController
});
function ReadingsController(..., FileSaver, ...) {
So, now this command sequence works:
npm install
bower install
gulp
But I get this error in the browser
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module ngFileSaver due to:
Error: [$injector:nomod] Module 'ngFileSaver' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.6.0/$injector/nomod?p0=ngFileSaver
How can I get this package working via npm instead of bower?
I have the following function that is trying to load a .ejs file with the following path.
function PaintNewOpponent() {
ejs.renderFile('views/NewOpponent.ejs', {pPlayer:pPlayerLocal}, function(err, str) {
$("#AddPlayerDialog").html(str);
alert(err)
RenderEvents();
FillInModalinformation()
});
}
I have run an alert check with __dirname and have discovered that I am in the correct directory. Here is a screenshot of my explorer window from Visual Studio Code.
the directory html is in my root directory. __dirname returns that I am in /html/js. PaintNewOpponent() is inside my NewOpponent.js file. Yet the ejs.renderFile call comes back in error saying it cannot file the file. Everything is in place.
If necessary here is package.json file
{
"name": "combattracker",
"version": "3.0.0",
"description": "AutoHARP 3: Combat Tracker",
"main": "index.js",
"license": "ISC",
"scripts": {
"start": "electron .",
"package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
"package-win": "electron-packager . electron-tutorial-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"AutoHARP 3\"",
"package-linux": "electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds"
},
"author": "David Klecker",
"dependencies": {
"bootstrap": "^4.5.2",
"bootstrap-sass": "^3.4.1",
"commonjs": "0.0.1",
"ejs": "^3.1.5",
"electron": "^10.1.2",
"electron-alert": "^0.1.11",
"electron-reload": "^1.5.0",
"embed-js": "^5.0.4",
"jquery": "^3.5.1",
"parser": "^0.1.4",
"popper.js": "^1.16.1",
"uniter": "^2.16.0",
"xml2js": "^0.4.23",
"xmlbuilder": "^15.1.1"
},
"devDependencies": {
"electron-packager": "^15.1.0"
}
}
I don't know if this will help but what I do is to build an absolute path using the path library (actually I use upath for cross platform compatibility because I often need to save the path to a file).
const iconPath = upath.joinSafe(__dirname, 'app', 'assets', 'win_icon_64x64.png');
I've been trying to install angular-ui-tree using bower version 1.8.0, but it keeps hanging up on me.
I've tried the following commands:
bower install angular-ui-tree
bower install angular-ui-tree --save
bower install angular-ui-tree --save --verbose
bower install angular-ui-tree --verbose
Verbose doesn't print a stack trace, however all commands above print the info of already installed packages.
I've also tried using bower init or restoring previous versions of bower.json, but to no avail.
The original bower.json file:
{
"name": "meten",
"version": "0.0.1",
"dependencies": {
"angular": "*",
"bootstrap": "*",
"angular-animate": "*",
"angular-bootstrap": "*",
"angular-cookies": "*",
"angular-resource": "*",
"angular-route": "*",
"angular-sanitize": "*",
"angular-smart-table": "*",
"angular-touch": "*",
"angular-strap": "*",
"angular-nvd3": "*",
"papaparse": "*",
"components-font-awesome": "^4.7.0"
},
"devDependencies": {
"angular-mocks": "*"
},
"appPath": "app",
"moduleName": "metenApp",
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
}
}
What can I do to fix bower?
here is my build command. current folder has additiona files like settings.config, readme.md these files are not included in the build output.
"build-win": "electron-packager . AppName --overwrite --out=dist --ignore='^/dist$' --prune --asar --platform=win32 --arch=all --version=0.36.0 --icon=img/favicon.ico"
This is the package.json
{
"name": "ElectronDesktopTest",
"productName": "ElectronDesktopTest",
"version": "1.0.0",
"description": "Electron Desktop Test",
"main": "main.js",
"electronVersion": "0.36.0",
"scripts": {
"start": "electron main.js",
"build-win": "electron-packager . ElectronDesktopTest --overwrite --out=dist --ignore='^/dist$' --prune --asar --platform=win32 --arch=all --version=0.36.0 --icon=img/favicon.ico"
},
"author": "Jyo",
"devDependencies": {
"electron-prebuilt": "^0.36.0",
"electron-packager": "^5.2.0"
},
"dependencies": {
"electron-reload": "^0.2.0",
"fs-extra": "^0.26.5",
"gray-matter": "^2.0.2",
"jade": "^1.11.0",
"jquery": "^2.2.0",
"lunr": "^0.6.0",
"showdown": "^1.3.0",
"underscore": "^1.8.3"
}
}
If question tagged electron-builder, you can try to use electron-builder ;)
I've been trying to update moment.js (& several other plugins) using Bower, updating moment from 2.8.4 to 2.9.
I changed my bower.json file to be "moment": "2.x" (was ~2.8.3, I also tried ~2.8, then 2.x) & bower says it's cached and validated but running bower list shows 2.8.4 is still installed.
Whenever I try an update or install it goes through all my dependencies.
I then uninstalled moment (which worked), but now bower won't install it, bower list gives moment not installed.
I'm running the latest Bower 1.4.0.
My bower.json:
{
"name": "intranet",
"version": "1.12.35",
"authors": [
"SteB"
],
"license": "proprietary",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"jquery": "~2.1",
"jquery-migrate": "~1.2",
"modernizr": "~2.8.3",
"moment": "2.x",
"respond": "~1.4.2",
"jquery-ui": "~1.11",
"chartjs": "~1.0.2",
"rickshaw": "~1.5.1",
"gmaps": "~0.4.14",
"d3": "~3.4.11",
"bootstrap-modal": "~2.2.5",
"kbwood_countdown": "~2.0.1",
"bootstrap": "2.3.2",
"footable": "2.0.1.5",
"bootstrap-maxlength": "~1.5.7",
"flot": "~0.8.3",
"jqplot": "*",
"scrollup": "2.4.*",
"fullcalendar": "1.6.4",
"bootstrap-switch": "~2.0.5",
"es5-shim": "~4.1",
"chosen": "~1.2",
"platform": "~1.3",
"fontawesome": "~4.2.0",
"jquery.steps": "~1.1",
"jquery-cookie": "~1.4",
"typeahead.js": "~0.10.5",
"ladda": "~0.9.7"
},
"devDependencies": {},
"resolutions": {
"bootstrap": "2.3.2",
"jquery": "~2.1"
}
}
Delete yr previous "bower_components" folder or any other target installation location specified in ".bowerrc"
Use below bower.json (null to get latest version)
Run "bower install"
{
"name": "intranet",
"version": "1.12.35",
"authors": [
"SteB"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"license": "proprietary",
"dependencies" : {
"jquery": null,
"jquery-migrate": null,
"modernizr": null,
"moment": null,
"respond": null,
"jquery-ui": null
}
}
Above will do fine. You need to check yr rest dependencies on bower bcz there naming seems to be incorrect