I am using laravel 5.4 and I wanted to set up elixir to compile sass files. I tried to install elixir by running $ npm install and after that, I tried running $ gulp but it gave me the following error:
/home/vagrant/Code/Laravel/gulpfile.js:1
(function (exports, require, module, __filename, __dirname) { elixir(mix => {
^
ReferenceError: elixir is not defined
at Object.<anonymous> (/home/vagrant/Code/Laravel/gulpfile.js:1:63)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at execute (/usr/lib/node_modules/gulp-cli/lib/versioned/^3.7.0/index.js:24:18)
at Liftoff.handleArguments (/usr/lib/node_modules/gulp-cli/index.js:149:63)
After adding const elixir = require('laravel-elixir');, I am getting this error:
[02:28:30] Starting 'webpack'...
{ [Error: ./resources/assets/js/components/Example.vue
Module parse failed: /home/vagrant/Code/Laravel/resources/assets/js/components/Example.vue Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <template>
| <div class="container">
| <div class="row">
# ./resources/assets/js/app.js 16:25-60]
message: './resources/assets/js/components/Example.vue\nModule parse failed: /home/vagrant/Code/Laravel/resources/assets/js/components/Example.vue Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n| <template>\n| <div class="container">\n| <div class="row">\n # ./resources/assets/js/app.js 16:25-60',
showStack: false,
showProperties: true,
plugin: 'webpack-stream',
__safety: { toString: [Function: bound ] } }
I have the same issue when installing a new laravel app 5.4. When I try to run gulp webpack it shows same error in my console. So what I did, since the laravel 5.4 comes with the new vue version which is the vue 2. You need to require require('laravel-elixir-vue-2'); See sample below:
gulpfile.js
var elixir = require('laravel-elixir');
require('laravel-elixir-vue-2'); // recommended for vue 2
elixir(function(mix) {
// some mixes here..
mix.webpack('app.js');
});
If you got errors like elixir related, just npm install them. also check this page here
.
Related
I set up a fresh Laravel Breeze Project with Vite. When I run:
npm run dev
I get this Error:
failed to load config from PATH/vite.config.js
error when starting dev server:
Error: cannot test case insensitive FS, CLIENT_ENTRY does not point to an existing file: PATH/dist/client/client.mjs
at testCaseInsensitiveFS (PATH/node_modules/vite/dist/node-cjs/publicUtils.cjs:3420:15)
at Object.<anonymous> (PATH/node_modules/vite/dist/node-cjs/publicUtils.cjs:3425:1)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Object._require.extensions.<computed> [as .js] (file:///PATH/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:63517:17)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (PATH/node_modules/vite/index.cjs:7:31)
I can't find any Information about this error! A few Weeks ago I had no Problems with this.
Here is my Vite Config File:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
],
refresh: true,
}),
],
});
Thanks in advance
Make sure that your project path doesn't contain any special character like #.
Completely new to this stuff. Trying to deploy an NFT for my bachelor's thesis in a non-technical field.
I've been following this guide:
https://www.freecodecamp.org/news/how-to-make-an-nft/
And it's been going pretty well up until the point where I'm supposed to deploy the NFT and edit the HardHat config file to compile everything.
The guide has been using the "ropsten" network while I'm using rinkeby. Is that the problem?
This is my HardHat config file:
require("dotenv").config();
require("#nomiclabs/hardhat-ethers");
module.exports = {
solidity: "0.8.0",
defaultNetwork: "rinkeby",
networks: {
hardhat: {},
rinkeby: {
url: process.env.https://eth-rinkeby.alchemyapi.io/v2/MYURLCODE,
accounts: [`0x${process.env.MYPRIVATEKEY}`],
},
},
};
And this is my error message:
MYNAME#Ivans-MacBook-Pro ethereum % npx hardhat compile
An unexpected error occurred:
/Users/MYNAME/nft-project/ethereum/hardhat.config.js:10
url: process.env.https://eth-rinkeby.alchemyapi.io/v2/MYURL,
^
SyntaxError: Unexpected token ':'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at importCsjOrEsModule (/Users/MYNAME/nft-project/ethereum/node_modules/hardhat/src/internal/core/config/config-loading.ts:28:20)
at loadConfigAndTasks (/Users/MYNAME/nft-project/ethereum/node_modules/hardhat/src/internal/core/config/config-loading.ts:80:18)
Would be incredibly grateful for any help!
by looking at the snippet i guess this line url: process.env.https://eth-rinkeby.alchemyapi.io/v2/MYURLCODE should become:
url: `https://eth-rinkeby.alchemyapi.io/v2/${process.env.MYURLCODE}`
assuming that your MYURLCODE env variable contains the correct value.
I have an existing project, I used React 16.9. Now, I want to implement Gulp 4.0.1 to build it in the server. I am running in windows 10.
In my components, I am using import form
I tried using this gulpfile.js, its very simple.
var gulp = require('gulp'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer');
var BUILD_DIR = 'buildtest/';
function compile() {
var bundler = browserify('src/index.js');
return bundler
.transform('babelify', { presets: ['es2015', 'react'] })
.bundle()
.pipe(source('index.js'))
.pipe(buffer())
.pipe(gulp.dest(BUILD_DIR));
}
gulp.task('build:js', function() {
return compile();
})
gulp.task('build', ['build:js'])
Now by running the gulp command it gives me this error:
λ gulp
assert.js:350
throw err;
^
AssertionError [ERR_ASSERTION]: Task function must be specified
at Gulp.set [as _setTask] (D:\myprojectfolderpath\node_modules\undertaker\lib\set-task.js:10:3)
at Gulp.task (D:\myprojectfolderpath\node_modules\undertaker\lib\task.js:13:8)
at Object.<anonymous> (D:\myprojectfolderpath\gulpfile.js:84:6)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
According to the gulp's task Documentation gulp.task([taskName], taskFunction) second argument the 'taskFunction' needs to use either a gulp.series() or gulp.parallel.
Before 4.0 it was possible to define the task as you did, but this changed in 4.0.
Changing your gulp.task('build', ['build:js']) into gulp.task('build', gulp.series('build:js')) should fix the issue.
I want to run WebdriverIO + Mocha tests from the WebStorm gutter (the green triangle icons on the left side, by the line numbers).
But when I press run triangle - error occurred:
/Users/ilyubin/.nvm/versions/node/v10.15.0/bin/node /Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/bin/_mocha --ui bdd --reporter /Applications/WebStorm.app/Contents/plugins/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js /Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/test/specs/catalog/not.found.page.spec.js --grep "^Тесты страницы ошибок Поиск несуществующего запроса$"
/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/test/specs/catalog/not.found.page.spec.js:1
(function (exports, require, module, __filename, __dirname) { import {expect} from 'chai';
^
SyntaxError: Unexpected token {
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at /Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/mocha.js:324:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/mocha.js:321:14)
at Mocha.run (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/mocha.js:763:10)
at Object.exports.singleRun (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/cli/run-helpers.js:196:16)
at exports.runMocha (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/cli/run-helpers.js:291:13)
at Object.exports.handler.argv [as handler] (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/cli/run.js:292:3)
at Object.runCommand (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/node_modules/yargs/lib/command.js:238:44)
at Object.parseArgs [as _parseArgs] (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/node_modules/yargs/yargs.js:1072:28)
at Object.parse (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/node_modules/yargs/yargs.js:566:25)
at Object.exports.main (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/lib/cli/cli.js:62:6)
at Object.<anonymous> (/Users/ilyubin/git/ozon.ru/packages/ozon.ru-ui-tests/node_modules/mocha/bin/_mocha:10:23)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
How to run WebdriverIO tests from WebStorm?
My versions:
WebStorm 2018.3.3
Build #WS-183.5153.33, built on January 9, 2019
JRE: 1.8.0_152-release-1343-b26 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.2
➜ ~ node -v
v10.15.0
➜ ~ mocha --version
5.2.0
My dependencies:
"dependencies": {
"#wdio/allure-reporter": "^5.4.9",
"#wdio/cli": "^5.4.13",
"#wdio/local-runner": "^5.4.13",
"#wdio/mocha-framework": "^5.4.13",
"#wdio/spec-reporter": "^5.4.3",
"#wdio/sync": "^5.4.13",
...
},
You can't run wdio specs using mocha test runner, so Mocha run configuration can't be used here. You need using Node.js run configuration instead:
Also, as you are using ES6 syntax in your tests, you have to configure wdio to use babel. See https://webdriver.io/docs/babel.html for instructions:
npm install --save-dev #babel/core #babel/cli #babel/preset-env #babel/register
in the project root folder, create a file babel.config.js:
module.exports = {
presets: [
['#babel/preset-env', {
targets: {
node: 8
}
}]
]
}
in your wdio.conf.js, set up mocha as follows;
mochaOpts: {
ui: 'bdd',
timeout: 60000,
compilers: ['js:#babel/register']
},
I'm trying to get Netlify Functions work with Go.
First, I tried cloning official example repo (https://github.com/netlify/aws-lambda-go-example) and it worked.
My problem is, I have a Hugo website which require hugo build command and I don't know how to build Hugo with hugo and Go source files with make build (like in example repo) - I think it could solve the problem, but I couldn't find relevant docs describing this option.
So my next step was to manually compile Go function file and put it into functions folder.
source file (from the example above):
package main
import (
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
)
func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
return events.APIGatewayProxyResponse{
StatusCode: 200,
Body: "Hello AWS Lambda and Netlify",
}, nil
}
func main() {
// Make the handler available for Remote Procedure Call by AWS Lambda
lambda.Start(handler)
}
I used instruction available at https://github.com/aws/aws-lambda-go#building-your-function to compile Go binary:
GOOS=linux GOARCH=amd64 go build -o hello hello.go
zip hello.zip hello
mv hello.zip ./functions/hello.zip
This was pushed to Git and therefore deployed to Netlify. So far so good, my function appeared in Netlify UI.
But when I requested the function URL, I got error message:
{
"errorMessage": "Invalid or unexpected token",
"errorType": "SyntaxError",
"stackTrace": [
"",
"SyntaxError: Invalid or unexpected token",
"createScript (vm.js:80:10)",
"Object.runInThisContext (vm.js:139:10)",
"Module._compile (module.js:616:28)",
"Object.Module._extensions..js (module.js:663:10)",
"Module.load (module.js:565:32)",
"tryModuleLoad (module.js:505:12)",
"Function.Module._load (module.js:497:3)",
"Module.require (module.js:596:17)",
"require (internal/module.js:11:18)"
]
}
This is function log from Netlify:
1:18:16 AM: hello invoked
1:18:17 AM: Syntax error in module 'hello': SyntaxError
(function (exports, require, module, __filename, __dirname) { ELF
^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
1:19:02 AM: hello invoked
1:19:03 AM: Syntax error in module 'hello': SyntaxError
^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
Also, function name appears to be hello.js in Netlify UI - I don't know if it should be like that. It seems to me that AWS thinks it's Javascript instead of Go.
I have not tested a zipped go function on Netlify.
If you do not want to do the manual build in this case, you can inline your build commands on Netlify deploy.
Add a build command that does both builds for the project.
[build]
command = "make build && hugo"
functions = "functions"
publish = "public"
[build.environment]
# Change this path with the path to your repository
GO_IMPORT_PATH = "github.com/netlify/aws-lambda-go-example"