I am learning to configure Laravel Echo Socket.js and following an article here
Code in bootstrap.js is below
import Echo from "laravel-echo"
window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});
When I run the above code, it says, Cannot find module "laravel-echo"
I am not using pusher and redis. In the above reference page, I think, there is no installation guidelines given for only socket.io
Can somebody explain if I am missing anything?
I solved the same problem installing the following packages:
npm install --save laravel-echo pusher-js
I needed to install below packages.
npm install -g laravel-echo-server
then following the step by step instruction as give here
Finally put below code before any js file.
<script src="http://{{ Request::getHost() }}:6001/socket.io/socket.io.js"></script>
the issue is here:-
import Echo from "laravel-echo"
you will write it as:-
import Echo from 'laravel-echo';
Related
I just started playing around with AWS CDK yesterday and I found something very weird.
First of all, I'm using TypeScript for my CDK app (I used cdk init --language typescript to generate the project files and I tried to import aws-ec2 module so this is what I did:
import cdk = require('#aws-cdk/core');
import ec2 = require('#aws-cdk/aws-ec2');
export class vpcStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
//.... all other codes go here....
However, when importing the aws-ec2 module this way, I got this error when trying to deploy the stack:
тип Unable to compile TypeScript:
lib/cdk-type_script-stack.ts:2:22 - error TS2307: Cannot find module '#aws-cdk/aws-ec2'.
2 import ec2 = require('#aws-cdk/aws-ec2');
~~~~~~~~~~~~~~~~~~
Subprocess exited with error 1
This is very weird because the API docs right here clearly stated that this is how I should import the aws-ec2 module in TypeScript
You need to install the node package before you could import and use it
Execute below on the command line to install npm package for aws-cdk
npm i #aws-cdk/aws-ec2
npm install (for install lib)
npm run build (for compile your code)
After that, you can run:
cdk synth
cdk deploy
You may have a version of npm that is incompatible with the version of #aws-cdk/pipelines as explained here: https://github.com/aws/aws-cdk/issues/13541#issuecomment-801606777
In addition to #juned-ashan 's answer, verify that you are installing the correct module version that corresponds to your cdk version (and other cdk modules installed).
For example:
$ npm install --save #aws-cdk/aws-ec2#1.10.0
Note: not enough points to add this as a comment in Juned's answer.
I am trying to launch a django service using docker which uses nltk library.
In the dockerfile I have called a setup.py which calls nltk.download. According to the logs I see during building the docker image this step runs successfully.
But when I run the docker image and try to connect to my django service, I get the error saying that nltk.download hasn't happened yet.
Dockerfile code -
RUN . ${PYTHON_VIRTUAL_ENV_FOLDER}/bin/activate && python ${PYTHON_APP_FOLDER}/setup.py
setup.py code -
import nltk
import os
nltk.download('stopwords', download_dir=os.getcwd() + '/nltk_data/')
nltk.download('wordnet', download_dir=os.getcwd() + '/nltk_data/')
Error:
**********************************************************************
Resource stopwords not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('stopwords')
Searched in:
- '/root/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
- '/usr/src/venv/nltk_data'
- '/usr/src/venv/share/nltk_data'
- '/usr/src/venv/lib/nltk_data'
**********************************************************************
Any idea what is wrong here?
Also, the same code works when I run it without docker.
Having faced that same problem before and having done almost the same thing you did, I'd assume what you're missing here is configuring the nltk.data.path by adding to the path wherever your os.getcwd() is.
Thanks for the post and it fixed my issue as well!!!!
I got the same issue that punkt does exit in docker:
/root/nltk_data/tokenizers/punkt
But when my app tried to reach it, Docker kept complaining the resource couldn't be found.
Inspired by your post, I added:
ENV NLTK_DATA /root/nltk_data/
ADD . $NLTK_DATA
But still got the same error message. So I tried this:
ENV NLTK_DATA /nltk_data/
ADD . $NLTK_DATA
I didn't know why I wanted to remove /root from the path but it worked!
My app is using Flask and uWSGI, so I guess maybe this is an issue for Django and Flask? Thanks anyway!
I'm building an Ionic 2 (RC0) application and I'm trying to use node-uuid by following the official documentation.
I've done:
$ npm install --save node-uuid
$ npm install --save #types/node-uuid
node-uuid seems to be using the default export approach, so I'm importing it in my typescript file like this:
import uuid from 'node-uuid';
And using it as follows:
console.log(uuid.v4);
However, my app doesn't come up and I see this error in the logs:
TypeError: des$3 is undefined
What am I missing?
Most resources for Angular 2 recommend using the typings CLI to install the type definitions, but this made no difference for me. I tried:
$ npm install --global typings
$ typings install --save node-uuid
$ ionic info
Your system information:
Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.3.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS
Node Version: v6.6.0
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
Please note that node-uuid is deprecated. They merged with another project and now it's only called uuid. Everything up to the point of installing the #types library is correct. (note that you will have to redo those steps using just 'uuid' not 'nod-uuid')
However,
console.log(uuid.v4);
does not generate an id. As per the documentation you need to specify in your import which version of uuid you want to use and then call your variable as a method: uuid();
From docs: [Deprecation warning: The use of require('uuid') is deprecated and will not be supported after version 3.x of this module. Instead, use require('uuid/[v1|v3|v4|v5]') as shown in the examples below.]
Here is a code example using uuid/v1:
import { Component } from '#angular/core';
import uuid from 'uuid/v1'; //here change 'v1' with the version you desire to use
#Component({
selector: "page-uuid",
templateUrl: "uuid.html"
})
export class uuidTestPage {
id = uuid();
constructor() {
console.log(this.id); // outputs id. For example: 298da400-1267-11e8-a6e5-3148ee6706e9
}
}
After you serve your app and enter the uuidTestPage you should see the id logged to the console. The format of the id will vary depending on the version you use:
Version 1 (timestamp): my example.
Version 3 (namespace)
Version 4 (random)
etc...
Happy coding!
you can try it: (angular2-uuid)
npm install angular2-uuid --save
......
import { UUID } from 'angular2-uuid';
...
let uuid = UUID.UUID();
it works on angular 2 & ionic 2
I am going to build a backend using Stripe api on AWS Lambda.
But I can't import stripe library.
import stripe
This line gives me this error.
{
"errorMessage": "Unable to import module 'lambda_function'"
}
Anybody can help me?
The Stripe python libraries need to be installed to the same folder as the python script you are writing.
The pip command to do this is:
pip install --install-option="--prefix=/full/local/path/to/your/python/script" --upgrade stripe
This will actually install the libraries into the "lib" folder in the path you indicated. Copy everything from /full/local/path/to/your/python/script/lib/python2.7/site-packages to /full/local/path/to/your/python/script
Your directory will then look something like this:
./main.py
./requests/
./requests-2.13.0-py2.7.egg-info/
./stripe/
./stripe-1.55.0-py2.7.egg-info/
Zip up those files and then upload that ZIP file to AWS Lambda.
I know this question is over a year old, but it's still unanswered, and is what still turned up when I searched for this same problem, so here is how I solved it.
To add to James Eberhardt's answer using --target will place files directly into desired location.
pip install --target="/full/local/path/to/your/python/script" --upgrade stripe
I'm trying to run a go script as part of the build process. The script imports a 'custom' package. However I get this import error.
The repository name is bis. The script which I run is configbis.go. The package imported configbis.go is mymodule
The project structure is as following:
bisrepo -------
| |
mymodule configbis.go
go run configbis.go
configbis.go:16:2: cannot find package "bisrepo/mymodule" in any of:
/home/travis/.gvm/gos/go1.1.2/src/pkg/bisrepo/mymodule (from $GOROOT)
/home/travis/.gvm/pkgsets/go1.1.2/global/src/bisrepo/mymodule (from $GOPATH)
I've tried to import mymodule in configbis.go as following:
import "mymodule"
import "bisrepo/mymodule"
import "github.com/user/bisrepo/mymodule"
None of them works. I run out of ideas/options ...
I read the the travis-ci documentation and I found it useless.
You could try to add something like that in your .travis.yml:
install:
- go get github.com/user/bisrepo/mymodule
in order to use private repos you must provide a github api auth token (similarly so when deploying go projects which reference private repos on Heroku). You can try adding something like this in your .travis.yml
before_install:
- echo "machine github.com login $GITHUB_AUTH_TOKEN" > ~/.netrc