I compiled the "Hello world" program
import Html exposing (text)
main =
text "Hello, World!"
with elm 0.17 on Windows, without compile errors:
elm make hello.elm --output index.html
When I open Chrome on index.html, I get a blank page. Chrome's console shows 2 errors in index.html :
Uncaught ReferenceError: _elm_lang$virtual_dom$VirtualDom$text is not defined
Uncaught ReferenceError: Elm is not defined
If I run the elm-reactor on that file, I also get a white page, and similar errors in the console.
Somehow, a path is missing... Here is the elm-package.json file:
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "4.0.0 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0"
},
"elm-version": "0.17.0 <= v < 0.18.0"
}
What should I do ?
I fixed it by deleting the elm-stuff subdirectory. At the next make, it reinstalls the missing packages, and everything works fine.
Related
I've just started a brand new project using create-react-app and set up react-leaflet as their documentation recommends here.
I am trying to use this example to check if it's all working good but then I'm receiving the following error:
./node_modules/#react-leaflet/core/esm/path.js 10:41
Module parse failed: Unexpected token (10:41)
File was processed with these loaders:
* ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| useEffect(function updatePathOptions() {
| if (props.pathOptions !== optionsRef.current) {
> const options = props.pathOptions ?? {};
| element.instance.setStyle(options);
| optionsRef.current = options;
Looks like react-scripts can't handle react-leaflet files.
Can someone helps me to understand why it's happening and how do I fix it ?
After reading about it on all blogs , I have concluded that :
It's because of the new version of the react-leaflet. I faced the same problem and here's how I got rid of the error:
Open your package.json file
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
Replace it with following lines :
"browserslist": [
">0.2%",
"not dead",
"not op_mini all"
],
Now Delete node_modeules/.cache folder
npm install
npm start
Another method is to just add these lines in your package.json file:
"react-leaflet": ">=3.1.0 <3.2.0 || ^3.2.1",
"#react-leaflet/core": ">=1.0.0 <1.1.0 || ^1.1.1"
This will skip the newly released version of the #react-leaflet/core package
I'm trying to include aurelia-tabbed in my aurelia project (of which I think I have the latest version, but I can't find a version number anywhere). I have a problem however, because I'm using a bundle of my app and vendor js, and I don't know how to include the package.
I've tried adding this in my aurelia.json in build > bundles > (vendor) > dependencies:
{
"name": "aurelia-tabbed",
"path": "../node_modules/aurelia-tabbed/dist/amd",
"main": "index",
"resources": ["assets/tabs.css"]
},
However, while this compiles, I cannot run the webpage. It gives me errors in the console (even before I add any of the tabbed tags):
DEBUG [aurelia] Configured plugin aurelia-tabbed.
vendor-bundle.js:5700 GET http://localhost:9001/analysis/test-page/node_modules/aurelia-tabbed/dist/amd/tab-headers.js
vendor-bundle.js:5700 GET http://localhost:9001/analysis/test-page/node_modules/aurelia-tabbed/dist/amd/tabs-wrapper.js
vendor-bundle.js:5700 GET http://localhost:9001/analysis/test-page/node_modules/aurelia-tabbed/dist/amd/tab-content.js
vendor-bundle.js:1395 Unhandled rejection Error: Script error for "aurelia-tabbed/tab-headers"
http://requirejs.org/docs/errors.html#scripterror
at makeError (http://localhost:9001/scripts/vendor-bundle.js:3907:17)
at HTMLScriptElement.onScriptError (http://localhost:9001/scripts/vendor-bundle.js:5477:36)
The three calls all result in 404's (which is normal, because the node_modules path is located at the root).
However: why are the three calls even made? Aren't the files supposed to be bundled?
In your aurelia.json file, you need to list all resources of the plugin. Try the following:
{
"name": "aurelia-tabbed",
"path": "../node_modules/aurelia-tabbed/dist/amd",
"main": "index",
"resources": [
"tab-content.html",
"tab-headers.html",
"tabs-wrapper.html",
"assets/tabs.css"
]
},
i tried running the sample code provided in the casperjs homepage, but i got this error .
I'm trying it on mac,
I'm using version for casperjs = 1.1.3
phatomjs version = 2.1.1
whenever i try tu run it wiht this command it spits error
casperjs sample.js
output >
CasperError: Cant find module fs
casperjs sample.js
CasperError: Can't find module fs
phantomjs://code/bootstrap.js:297 in patchedRequire
phantomjs://platform/colorizer.js:35
CasperError: Can't find module fs
phantomjs://code/bootstrap.js:297 in patchedRequire
phantomjs://platform/casper.js:36
TypeError: undefined is not a constructor (evaluating 'require('casper').create()')
phantomjs://code/sample.js:1 in global code
:0 in injectJs
phantomjs://code/bootstrap.js:435
Heres my code.
var casper = require('casper').create();
casper.start('http://casperjs.org/', function() {
this.echo(this.getTitle());
});
casper.thenOpen('http://phantomjs.org', function() {
this.echo(this.getTitle());
});
casper.run();
fyi: I installed casper and phantom via brew in the past.
I'm willing to use node module route, or by installing the master branch from github or any other route to get it working. Kindly advise.
package.json
{
"name": "automationtools",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: - no test specified\" && exit 1",
"start": "./node_modules/.bin/casperjs main.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"casperjs": "^1.1.3",
"fs": "0.0.1-security",
"phantomjs": "^2.1.7"
}
}
I'm using all these node packages on local. I dont know if they're picked up from here or from global. Please suggest how do I check that ?
Im running it via $ npm start which is a shortcut thats there in the package file.
Please feel free to ask me any questions, how I can narrow down this question.
Question: It says that can't find fs, but i read somewhere that fs is now part of node itself.
○ node --version
v4.5.0
Here is my project's elm-package.json
{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "5.1.1 <= v < 6.0.0",
"elm-lang/html": "2.0.0 <= v < 3.0.0",
"simonh1000/elm-charts": "3.1.0 <= v < 4.0.0"
},
"elm-version": "0.18.0 <= v < 0.19.0"
}
elm-charts exports a module called Chart.
In my ChartView.elm I want to import Chart
module Components.ChartView exposing ( .. )
import Chart as C exposing ( .. )
import Html exposing ( Html, div )
import Html.Attributes exposing ( id, class )
but when elm tries to compile, I get the error:
I cannot find module 'Chart'.
Module 'Components.ChartView' is trying to import it.
Potential problems could be: * Misspelled the module name * Need
to add a source directory or new dependency to elm-package.json
if I open elm repl from the project directory, I can import Chart as expected:
jon#jon-Xubuntu-VB:~/elixir/eval$ elm repl
\> import Chart
\>
any ideas why I Elm can't 'find Chart' when compiling?
Though this has been resolved in comments, no one has written this in an answer yet.
Elm will not find dependencies from nested directories: you want to run elm repl in the same directory as your elm-package.json (adjacent to the elm-stuff directory). It sounds like you mistakenly have an elm-package.json file at the top level of your app, when you wanted it in the web/elm/ directory.
I am trying to get the Amazon Cognito Identity SDK working in Aurelia. I do not have a lot of Javascript experience and am very unfamiliar with the various dependency systems.
I installed the Cognito SDK using: npm install --save amazon-cognito-identity-js
I then edited my aurelia_project/aurelia.json file as suggested in the Aurelia documentation to include a new client library dependency in build.bundles vendor-bundle dependencies:
"sjcl",
"jsbn",
{
"name": "aws-sdk",
"path": "../node_modules/aws-sdk/",
"main": "dist/aws-sdk"
},
{
"name": "amazon-cognito-identity-js",
"path": "../node_modules/amazon-cognito-identity-js/dist",
"main": "amazon-cognito-identity.min"
}
However, when I try to run the code using au run I get the error: Error: ENOENT: no such file or directory, open '/Users/nathanskone/Projects/scc/aurelia-app/src/xmlbuilder.js'
I have tried to include xmlbuilder in my aurelia.json to no avail. When it is included I end up getting this error about lodash: Error: ENOENT: no such file or directory, open '/Users/nathanskone/Projects/scc/aurelia-app/src/lodash/object/assign.js'
I haven't found any way to get past the lodash error.
Is there anyone out there familiar with the Aurelia dependency system that could help?
Thanks,
Nathan
EDIT #2: While I got past the xmlbuilder/lodash errors, I have run into further errors trying to bundle the aws-sdk. Here is my current aurelia.json:
"dependencies": [
{
"name": "xmlbuilder",
"path": "../node_modules/xmlbuilder/lib",
"main": "index"
},
{
"name": "aws-sdk",
"path": "../node_modules/aws-sdk",
"main": "index",
"resources": ["lib/region_config.json"]
},
And the error I am currently getting:
Error: ENOENT: no such file or directory, open '/Users/nathanskone/Projects/scc/aurelia-app/src/crypto.js'
If I remove the resources (lib/region_config.json) then I get this error instead:
Error: ENOENT: no such file or directory, open '/Users/nathanskone/Projects/scc/aurelia-app/node_modules/aws-sdk/lib/region_config.json.js'
I think crypto is actually an object defined in aws-sdk/lib/util.js, which is required by aws-sdk/lib/region_config.js.
Try the compiled library instead, using the compiled lib bundled just fine.
Also the library seems to define window.AWS, so injecting it or not will work
{
"name": "aws-sdk",
"path": "../node_modules/aws-sdk/dist",
"main": "aws-sdk.min",
"exports": "AWS"
}
UPDATE:
It seems the only way to import those libraries is by using the prepend section, the libraries write to the window variable so it can still be accesible to your app scripts, only by not importing them like ES6 modules.
"prepend": [
"node_modules/aws-sdk/dist/aws-sdk.min.js",
"node_modules/amazon-cognito-identity-js/dist/aws-cognito-sdk.min.js",
"node_modules/amazon-cognito-identity-js/dist/amazon-cognito-identity.min.js",
"node_modules/bluebird/js/browser/bluebird.core.js",
"scripts/require.js"
],