Module x has been defined multiple times - purescript

I have installed some purescript packages using bower and here is my bower.json file.
{
"name": "halogen-cube",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"output",
"dist"
],
"dependencies": {
"purescript-prelude": "^3.1.1",
"purescript-console": "^3.0.0",
"purescript-halogen": "^2.0.0",
"purescript-js-timers": "^3.0.0",
"purescript-halogen-svg": "*"
},
"devDependencies": {
"purescript-psci-support": "^3.0.0"
}
}
I wanted to add purescript-web-uievents package so I added "purescript-web-uievents" : "^2.0.0" to my bower.json file and installed all packages again.
But after that, when I run building app, I am getting this issue.
module Data.Map has been defined multiple times:
What should I do to fix this issue?
Thanks in advance.

This error is the result of the same module name existing in two different dependencies. This can happen when a module is moved from one package to another.
In the case of Data.Map, at one point it was a part of purescript-maps. However, this package is now deprecated; and Data.Map was moved to purescript-ordered-collections.
My guess is that you have one dependency that transitively includes purescript-maps while another depends on purescript-ordered-collections.

Related

babel 7.x - Can't resolve 'core-js/modules/es.array.concat'

I upgraded babel 6.x → 7.x but having issues running Webpack.
It is complaining about missing core-js/modules/*.
My babel.config.js is in the root directory. I converted the previously existing .babelrc to js (.babelrc also produced the same errors). I am guessing it is some collision with all the core, corejs2, runtime stuff.
There are two apps in my src, mine and Styleguidist (in ./node_modules). My app transpiles and works with these same package.json/babel.config, but Styleguidist does not.
The error when running Styleguidist with webpack:
Module not found: Error: Can't resolve 'core-js/modules/es.array.concat' in '/project/src/node_modules/react-styleguidist/lib/client/rsg-components/Slot'
/node_modules/react-styleguidist/lib/client/rsg-components/Slot.js:
import "core-js/modules/es.array.concat";
import "core-js/modules/es.array.filter";
...
package.json
"dependencies": {
"#babel/polyfill": "^7.0.0",
"#babel/runtime-corejs2": "^7.4.3",
}
"devDependencies": {
"#babel/core": "^7.4.3",
"#babel/plugin-proposal-class-properties": "^7.0.0",
"#babel/plugin-proposal-decorators": "^7.0.0",
"#babel/plugin-proposal-export-namespace-from": "^7.0.0",
"#babel/plugin-proposal-function-sent": "^7.0.0",
"#babel/plugin-proposal-json-strings": "^7.0.0",
"#babel/plugin-proposal-numeric-separator": "^7.0.0",
"#babel/plugin-proposal-object-rest-spread": "^7.4.3",
"#babel/plugin-proposal-throw-expressions": "^7.0.0",
"#babel/plugin-syntax-dynamic-import": "^7.0.0",
"#babel/plugin-syntax-import-meta": "^7.0.0",
"#babel/plugin-syntax-jsx": "^7.0.0",
"#babel/plugin-transform-modules-commonjs": "^7.4.3",
"#babel/plugin-transform-react-jsx": "^7.3.0",
"#babel/plugin-transform-runtime": "^7.4.3",
"#babel/preset-env": "^7.4.3",
"#babel/register": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-jest": "^24.7.1",
"babel-loader": "^8.0.0",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-transform-vue-jsx": "^4.0.1",
}
babel.config.js
module.exports = {
presets: ['#babel/preset-env'],
plugins: [
'#babel/plugin-transform-runtime',
'#babel/plugin-transform-react-jsx',
'transform-vue-jsx',
"#babel/plugin-proposal-object-rest-spread",
"#babel/plugin-syntax-dynamic-import",
"#babel/plugin-syntax-import-meta",
"#babel/plugin-proposal-class-properties",
"#babel/plugin-proposal-json-strings",
[
"#babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"#babel/plugin-proposal-function-sent",
"#babel/plugin-proposal-export-namespace-from",
"#babel/plugin-proposal-numeric-separator",
"#babel/plugin-proposal-throw-expressions"],
comments: false
}
Quoting from Babel 7.4.0 release :
#babel/polyfill isn't a plugin or preset, but a runtime package: if we added an option to switch between core-js#2 and core-js#3, both the package versions would need to be included in your bundle. For this reason, we decided to deprecate it: you now should load core-js for polyfills, and regenerator-runtime/runtime if you are transforming generators:
As you are using 7.4.3 version of babel, #babel/polyfill might not work as expected. Instead please add core-js and regenerator-runtime manually. Quoting from core-js3 release announcement:
Instead of
import "#babel/polyfill";
you should use those 2 lines:
import "core-js/stable";
import "regenerator-runtime/runtime";
Don't forget install those dependencies directly!
npm i --save core-js regenerator-runtime
I had the same issue and as often happens I forgot to have another package installed as:
"#babel/runtime-corejs3": "^7.5.5",
Don't forgot to install it at same level where you have the issue(either dev, local or production) level:
npm i -D(or --save-dev) #babel/runtime-corejs3
So in general this kind of errors happens when there are dependencies update change significantly in the version and aren't backward compatible with previous versions(API changes). Indeed corejs3 isn't at all compatible with corejs2 or older.
I found possible answer.
To resolve this error, you can downgrade the core-js version to 2.5.7. This version produces correct catalogs structure, with separate ES6 and ES7 folders.
To downgrade the version, simply run:
npm i -S core-js#2.5.7

Forcing Bower to Install Specific Leaflet Dependency - Resolution Not Working

I am attempting to bower install a variety of leaflet packages. Recently, leaflet upgraded to version 1.1.0 from 1.0.3 which broke several supported libraries. Until the community can fix the issues, I need to have leaflet 1.0.3 installed. Below is part of my bower.json:
"dependencies": {
"angular": "~1.5.0",
"angular-cookies": "~1.5.0",
"angular-bootstrap": "~2.4.0",
"angular-ui-router": "^0.3.2",
"angular-animate": "~1.5.8",
"bootstrap": "^3.3.7",
"font-awesome": "^4.7.0",
"normalize-css": "~3.0.3",
"modernizr": "~3.2.0",
"angular-smart-table": "^2.1.8",
"angular-websocket": "^2.0.0",
"angular-pageslide-directive": "^2.1.4",
"ng-scrollbars": "^0.0.11",
"angular-bootstrap-lightbox": "^0.12.0",
"angular-leaflet-directive": "leaflet-directive#^0.10.0",
"Leaflet.extra-markers": "^1.0.6",
"esri-leaflet": "2.0.7",
"angular-bootstrap-toggle": "^0.1.2",
"leaflet-search": "2.7.0",
"leaflet-draw": "0.4.9"
},
"devDependencies": {
"angular-mocks": "~1.4.7"
},
"resolutions": {
"angular": "^1.4.10",
"angular-bootstrap": "~2.4.0",
"leaflet": "1.0.3"
}
However, when I try to force the bower installation using the resolutions, I end up with the following:
I have another instance of this application running, and it still has 1.0.3 from a prior build. It is also using leaflet-draw 0.4.9, leaflet-search 2.7.0, etc... so I know that the 1.0.3 version is compatible.
Looking at each individual package, each bower.json only requires that leaflet: "^1.0.0".
Why is the bower resolution being ignored and not installing 1.0.3? Why is it not even giving me the option to choose 1.0.3 from the list? I considered downloading a local copy and doing an override, but that is not a preferred solution.

using non-modular libraries with SystemJs and jspm

To include ngDraggable into a project using systemJs and jspm, we need to add an override in package.json as below:
"overrides": {
"github:fatlinesofcode/ngDraggable#0.1.8": {
"dependencies": {
"angular": "jspm:angular#1.5.3"
},
"shim": {
"ngDraggable": [
"angular"
]
}
}
}
It's twice that we are mentioning that ngDraggable has a dependency on angular.. moreover the config.js file created by jspm also mentions this
"github:fatlinesofcode/ngDraggable#0.1.8": {
"angular": "github:angular/bower-angular#1.5.3"
},
Why do systemJs and jspm need this mentioned in so many different places ?
It's not twice since dependencies and shim.deps do different stuff.
The shim deps actually modifies the ngDraggable file and adds a "deps angular" statement. This allows you to specify each file dependency separately.

Composer package not found in any version

I am trying to create a custom vendor package but have not yet put the package on packagist. According to the docs, the package can be loaded from git (vcs) instead of packagist: https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository
The yii2 project (although don't think framework matters) I have created package inside vendor folder:
foundationize/yii2-foundation
(folder structure is as above, I have quadruple-checked).
My root public_html/composer.json has following entries:
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-swiftmailer": "*",
"foundationize/yii2-foundation": "dev-master"
},
My package composer file, vendor/foundationize/yii2-foundation/composer.json looks like:
{
"name": "foundationize/yii2-foundation",
"description": "The Foundation extension for the Yii2 framework",
"keywords": ["yii2", "foundation"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/foundationize/yii2-foundation/issues",
"wiki": "https://github.com/foundationize/yii2-foundation/wiki",
"source": "https://github.com/foundationize/yii2-foundation.git"
},
"authors": [
{
"name": "gvanto",
"email": "gvanto#hotmail.com",
"homepage": "http://foundationize.com"
}
],
"require": {
"yiisoft/yii2": "*"
},
"autoload": {
"psr-4": {
"foundationize\\foundation\\": ""
}
},
"repositories": [
{
"packagist": false,
"type": "vcs",
"url": "https://github.com/foundationize/yii2-foundation.git"
}
]
}
When I run composer install (or update), I keep getting error below:
Your requirements could not be resolved to an installable set of
packages.
Problem 1
- The requested package foundationize/yii2-foundation 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://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion
for more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for
further common problems.
I have googled it high and low, read the docs can't seem to get it to work (always the same error, which I actually think would be more useful if it said either the package was not found OR the incorrect package version was found).
You have to add the repositories entry to your root composer.json file. Otherwise, Composer does not know where to search for your package.
Had a similar problem to this and it was because I was running composer in the /web directory in the new Drupal structure. When I ran it in the root all was fine. Annoyingly, you need to run Drush in /web
Since Laravel version 5.5 there is a Package Auto-Discovery feature, so there is no need to add service provider. All you need to register package like this:
composer require barryvdh/laravel-debugbar:dev-master
You can find more info in these articles:
https://medium.com/#taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518
https://divinglaravel.com/laravels-package-auto-discovery

How to include ui.bootstrap.datepicker into ng-boilerplate

I am currently using ngboilerplate from: https://github.com/ngbp/ngbp
I want to include the 'ui.bootstrap.datepicker' from UI-Bootstrap (Twitter Bootstrap written natively in AngularJS). The problem is that this doesn't seem to be included in the latest version of ngboilerplate. Does anyone know how I can add this accordingly to the style of ngboilerplate.
This means that other developers can load it as a dependency with bower install.
After trying a couple of things it seems to be quite easy actually. I'll just answer this question in case someone else has the same problem.
I needed to install a new version of UI-Bootstrap. This can be done with bower by executing (on windows):
bower install angular-bootstrap
But this will give you a whole lot of other problems with dependencies.
To resolve this I use this bower.json:
{
"name": "Your-app",
"version": "0.3.1",
"devDependencies": {
"angular": "1.2.4",
"angular-mocks": "1.2.4",
"bootstrap": "3.0.3",
"angular-bootstrap": "0.10.0",
"angular-ui-utils": "0.0.3"
},
"dependencies": {
"angular-ui-router": "0.2.8-bowratic-tedium"
},
"resolutions": {
}
}
Another problem I had was that the LESS code for bootstrap isn't up to date. Instead I just included the bootstrap.css in my main.less file.