SystemJS can't load aurelia-event-aggregator even though Aurelia has already loaded it - aurelia

I'm simply trying to import 'aurelia-event-aggregator' into a TypeScript class and I get this error in my console. Even though it says it's loaded and configured aurelia-event-aggregator on lines 5 & 6, it says SystemJS still can't find it. This is especially strange since I'm also (successfully) importing autoinject from 'aurelia-dependency-injection' and customElement from 'aurelia-framework' without a problem, and they seem to be configured/installed identically to the event aggregator on my system via jspm.
My config.js and package.json are here.
I haven't the slightest idea how to start troubleshooting this. Please let me know if there's any other information I can provide.

This is going to sound dumb, but you need to run jspm install aurelia-event-aggregator. I know it's already in your project, but jspm 0.16 doesn't support peer dependencies (at least that's what I remember), so you have to explicitly install it as a top level dep for your app and then it will start working.

Related

react-native-config not working (Empty Config in both OS)

I'm really struggling with what seems like a very primitive error. I have installed react-native-config and when console.logging the Config object it returns {}.
The problem occurs both on android and iOS and it doesn't seem to be a linking issue because (even though RN 71.3 doesn't require manual linking) when following the steps to link manually on android I got an error saying RNCConfigPackage already linked.
This is a simplified version of my code:
import Config from 'react-native-config';
console.log(Config);
And this is what my .env file looks like:
REACT_APP_STAGE=development
TEST=ThisIsATest
ANOTHER_TEST=ThisIsAnotherTest
Debugging attempts
I have already tried:
Running gradlew clean and pod install (even though it's not a platform specific issue)
Run with ENVFILE=.env react-native run-android to hard code the env file
I understand that this is very limited information in order to debug the issue but any direction and help is appreciated including any approach you would follow to debug.
EDIT: The Config appeared in the end but is very late to update, an issue more people seem to be facing, I have used react-native-dotenv instead.

Requiring unknown module "3"

Requiring unknown module "3". If you are sure the module exists, try restarting Metro. You may also want to run 'yarn' or 'npm intall'.
Any one can help me with this erro on react-native. I'm using vscode and android studio.
Firstly, I encountered the same error message. Then I needed to solve the problem which occurred when I changed the folder structure, influences paths of imported files after I ran the app (on runtime). Actually the error message gives us the cause of the problem but I slogged on handling this error as a newbie on React Native. Frankly, the problem we have faced is about the packager as far as i have learnt.
It’s all about how the packager works. Packaging happens once before runtime so those variables don't have values yet.
Variables are components we have imported from other files in our situation.
The packager only works with statically analyzable “imports”. Treat “import” like a keyword.
As an example, let’s imagine you have folders in the root path of your project. If you run your Android Emulator, then packaging is carried through by Gradle under the hood.
import styles from './styles'
import StepCurrent from './images/stepcurrent.png'
import StepDone from './images/stepdone.png'
import StepNext from './images/stepnext.png'
Then if you try to change folder structure and call these components from another path, error occurs because packaging happened at the first phase, running the emulator, before your changes. Emulator does not read your current file paths.
import styles from './exampleFolder/styles'
import StepCurrent from './exampleFolder/images/stepcurrent.png'
import StepDone from './exampleFolder/images/stepdone.png'
import StepNext from './exampleFolder/images/stepnext.png'
So, you can restart your emulator to restart your packager. Then the problem disappears.
References:
The packager only works with statically analyzable 'requires'.
Packaging happens once before runtime.
Solution way is to restart packager.
My solution is reset metro server.
yarn start --reset-cache

ES6 import and npm packages

Anyone got a link to documentation explaining exactly how ES6 import is supposed to work with npm packages (as opposed to javascript module files) ?
Also (and possibly related) a link to documentation on the use/significance of "module" as a top-level key in an npm package.json file ?
Eg. consider the following from juggle/resize-observer ;
package.json
{
...
"module": "lib/exports/resize-observer.js",
...
}
consumer javascript file
import { ResizeObserver } from '#juggle/resize-observer';
On the above import Chrome sends a request to the server for '#juggle/resize-observer' which is a directory..... so what happens next ? (I don't have a working instance of this and my server doesn't return anything yet as I don't know what it's supposed to / in what format ). Is this syntax only for use with some sort of build tool where it ultimately gets replaced with the actual file ?
I have looked at the npm site/googled and cannot find any relevant documentation.
UPDATE Still waiting for a link to relevant documentation (no relevant Google results at this time) but for anyone asking the same question: apparently you need your server to do "module resolution" . Alternatively you can use Snowpack or a bundler eg. Webpack.
Apparently npm/node packages are not packaged with browsers in mind or based on any W3C/Web Modules standard specification.
See here for module resolution info.
So at present to use an npm package in a browser you must do one of the following
use a bundler like webpack
use snowpack
use a CDN which resolves the module request
implement npm module resolution in your own server
Find the package entry point and use that in your ES6 import statement.
However, if the package's json "main" property changes in a subsequent update you
will need to update your code to reflect this.

How to fix relative module error for a newly created nuxt.js app with starter template?

I tried to create a nuxt app with the guide from the official website, chose default options because I wanted the starter template but on running npm run dev, I keep encountering the error:
This relative module was not found:
* ./components/nuxt-error.vue in ./.nuxt/index.js
I've tried searching about it but I couldn't find any useful resource/fix. I've also tried vue init nuxt-community/starter-template for the installation but I still get the same error.
Any fixes?
So I found a solution. I couldn’t figure out the error because the nuxt-error.vue file was actually imported correctly. Turns out “npm” installations have been giving me issues (had issues with TailwindCSS too).
So if you ever encounter this error on loading the base nuxt app, recreate the project using “yarn” instead. Works like magic!
This Error basically means, that in one of your files you are trying to import another file with the relative path of ./components/nuxt-error.vue but no file with this path exists.
However
I just read that vue init nuxt-community/starter-template is deprecated and no longer maintained. Instead of fixing this Error you should restart your project with npx create-nuxt-app <yourAppName>. https://github.com/nuxt-community/starter-template

flowtype errors in base AwesomeProject

I recently wanted to reset a react-native project to most recent version, and so I initialised the seed project - "AwesomeProject"... The problem is that it comes with 19 flowtype errors "out of the box"
node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationCardStackStyleInterpolator.js
lines:91,94,97,104,107,137,142,148
node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationHeaderStyleInterpolator.js
lines:57,68,74,87,94
node_modules/react-native/Libraries/Experimental/WindowedListView.js
lines:629, 629, 665,665
node_modules/react-native/Libraries/Image/Image.ios.js
line:272
I am reluctant to make changes to these files as it may create knock on effects. Does anyone have a work around?
In general, whenever you want flow to ignore a file, you can just specify that file under the [ignore] section of your .flowconfig.
That said, I just react-native init'd a project, using react-native-cli 1.0.0 and react-native 0.29.1, and ran a flow server on the root of my project, and didn't get any errors.