Lodash-es is not working with mocha and babel - mocha.js

I created a simple workspace to demonstrate the problem:
.babelrc:
{
"presets": ["es2015"]
}
package.json
{
"name": "mocha-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha --compilers js:babel-register"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"lodash-es": "^4.17.4",
"mocha": "^3.5.3"
}
}
test/index.test.js
import {describe, it} from "mocha";
import {cloneDeep} from "lodash-es";
describe("Index", () => {
it("should work", () => {
// Init
const a = {a: 1};
const b = cloneDeep(a);
// Action
// Test
});
});
And the error I cannot fix:
> mocha-proba#1.0.0 test C:\...\mocha-demo
> mocha --compilers js:babel-register "test"
C:\...\mocha-demo\node_modules\lodash-es\lodash.js:10
export { default as add } from './add.js';
^^^^^^
SyntaxError: Unexpected token export
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\...\mocha-demo\node_modules\babel-register\lib\node.js:152:7)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:/.../mocha-demo/test/index.test.js:2:1)
at Module._compile (module.js:569:30)
at loader (C:\...\mocha-demo\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (C:\...\mocha-demo\node_modules\babel-register\lib\node.js:154:7)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at C:\...\mocha-demo\node_modules\mocha\lib\mocha.js:231:27
at Array.forEach (native)
at Mocha.loadFiles (C:\...\mocha-demo\node_modules\mocha\lib\mocha.js:228:14)
at Mocha.run (C:\...\mocha-demo\node_modules\mocha\lib\mocha.js:514:10)
at Object.<anonymous> (C:\...\mocha-demo\node_modules\mocha\bin\_mocha:480:18)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
Process finished with exit code 1
What should I do, to fix this problem? I am using lodash-es, because tree-shaking is better with this.

lodash-es is in esm module style while our common node module style is commonjs. You should use lodash instead.
Otherwise, following these steps to make it works:
Install esm:
npm install --save-dev esm
Run esm against mocha:
mocha -r esm test/**/*.test.js

Related

Could not load reporter by name: cypress-testrail-reporter

I'm trying to publish my cypress test result into testrail with cypress-testrail-reporter I set up my cypress.json as follows
{
"baseUrl": "https://myAppUrl.xyz",
"viewportWidth": 1920,
"viewportHeight": 1080,
"video": false,
"reporter": "cypress-testrail-reporter",
"reporterOptions": {
"host": "https://mycompnay.com/testrail",
"username": "user#mycompany.com",
"password": "testrailsPassword",
"projectId": 2,
"suiteId": 18120
}
}
And package.json as follows
{
"name": "vivifytestrailreporter",
"version": "1.0.0",
"description": "https://github.com/Vivify-Ideas/cypress-testrail-reporter#readme",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"cypress": "^7.2.0"
},
"devDependencies": {
"cypress-testrail-reporter": "^1.2.8"
}
}
Created a simple test that runs fine with npx cypress open and has the case id on it as follows
/// <reference types="Cypress" />
describe('Info tests', () => {
it('C1294180 - Verify info', () => {
... cy.commands to runt he test
});
});
But when I run npx cypress run to test and publish the results I got this error can you help me fix it
~/workspace/testrailReporterCustomized » npx cypress run
Could not load reporter by name: cypress-testrail-reporter
We searched for the reporter in these paths:
- /Users/juanvaldez/git/testrailReporterCustomized/cypress-testrail-reporter
- /Users/juanvaldez/git/testrailReporterCustomized/node_modules/cypress-testrail-reporter
Error: Could not locate the bindings file. Tried:
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/build/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/build/Debug/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/build/Release/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/out/Debug/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/Debug/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/out/Release/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/Release/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/build/default/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/compiled/14.15.1/darwin/x64/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/addon-build/release/install-root/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/addon-build/debug/install-root/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/addon-build/default/install-root/deasync.node
→ /Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/lib/binding/node-v87-darwin-x64/deasync.node
at bindings (/Users/juanvaldez/git/testrailReporterCustomized/node_modules/bindings/bindings.js:126:9)
at Object.<anonymous> (/Users/juanvaldez/git/testrailReporterCustomized/node_modules/deasync/index.js:30:31)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at Module._load (internal/modules/cjs/loader.js:776:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
at Function.Module._load (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/override_require.js:15:27)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/juanvaldez/git/testrailReporterCustomized/node_modules/cypress-testrail-reporter/dist/testrail.js:52:15)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at Module._load (internal/modules/cjs/loader.js:776:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
at Function.Module._load (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/override_require.js:15:27)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/juanvaldez/git/testrailReporterCustomized/node_modules/cypress-testrail-reporter/dist/cypress-testrail-reporter.js:21:18)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at Module._load (internal/modules/cjs/loader.js:776:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
at Function.Module._load (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/override_require.js:15:27)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/Users/juanvaldez/git/testrailReporterCustomized/node_modules/cypress-testrail-reporter/index.js:1:18)
at Module._compile (internal/modules/cjs/loader.js:1078:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
at Module.load (internal/modules/cjs/loader.js:935:32)
at Module._load (internal/modules/cjs/loader.js:776:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
at Function.Module._load (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/override_require.js:15:27)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Function.loadReporter (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/reporter.js:524:14)
at ProjectE2E.watchSettingsAndStartWebsockets (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/project-base.js:270:36)
at /Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/lib/project-base.js:142:49
at tryCatcher (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/juanvaldez/Library/Caches/Cypress/7.2.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:461:21)
Not sure you could solve this but I also ran across this today. Turns out the deasync package is causing an issue.
I reverted the cypress-testrail-reporter version to 1.2.2 which didn't use deasync as a dependency and it seems to work. If you haven't seen a more solid fix, this works for the time-being.
I am using the latest cypress 7.5.0 btw.

Object prototype may only be an Object or null: undefined Nativescript Angular

I have face the issue in nativescript angular. I'm using the Latest Nativescript(6.1.1) coremodules, android, ios versions 6.1.1, 6.1.2, 6.1.1 respectively. I also try in older version that also return the same error.
Before, My Nativescript version was 5.3.4 and run using Bundle Workflow.
/Users/Myapp/node_modules/webpack-cli/bin/cli.js:244
throw err;
^
TypeError: Object prototype may only be an Object or null: undefined
at setPrototypeOf (<anonymous>)
at Object.__extends (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/tslib/tslib.js:65:9)
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/template.js:115:17
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/template.js:314:6
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/template.js:3:17
at Object.<anonymous> (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/template.js:9:3)
at Module._compile (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/transform.js:20:22
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/transform.js:10:17
at Object.<anonymous> (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/indexer/src/transform.js:16:3)
at Module._compile (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/program.js:31:23
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/program.js:10:17
at Object.<anonymous> (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/ngtsc/program.js:16:3)
at Module._compile (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/transformers/program.js:27:21
at /Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/transformers/program.js:10:17
at Object.<anonymous> (/Users/deemsys/Documents/FoodApp_New/trunk/User/FoodCourt/node_modules/#angular/compiler-cli/src/transformers/program.js:16:3)
Package.json
"dependencies": {
"#angular/animations": "8.0.0",
"#angular/common": "8.0.0",
"#angular/compiler": "8.0.0",
"#angular/core": "8.0.0",
"#angular/forms": "8.0.0",
"#angular/http": "8.0.0-beta.10",
"#angular/platform-browser": "8.0.0",
"#angular/platform-browser-dynamic": "8.0.0",
"#angular/router": "8.0.0",
"font-awesome": "^4.7.0",
"nativescript-accordion": "^6.0.0-beta.2",
"nativescript-angular": "8.0.2",
"nativescript-checkbox": "^3.0.3",
"nativescript-drop-down": "^4.0.1",
"nativescript-feedback": "^1.3.9",
"nativescript-geolocation": "5.1.0",
"nativescript-iqkeyboardmanager": "^1.3.0",
"nativescript-loading-indicator": "^2.4.0",
"nativescript-ng-ripple": "^2.0.1",
"nativescript-phone": "^1.4.0",
"nativescript-plugin-firebase": "9.0.2",
"nativescript-ratings": "^1.0.1",
"nativescript-theme-core": "~1.0.4",
"nativescript-ui-listview": "7.0.0",
"reflect-metadata": "~0.1.10",
"rxjs": "~6.4.0",
"tns-core-modules": "^6.1.1",
"zone.js": "0.9.1"
},
"devDependencies": {
"#angular/compiler-cli": "8.2.0",
"#nativescript/schematics": "~0.4.0",
"#ngtools/webpack": "8.2.0",
"nativescript-dev-webpack": "^1.2.0",
"tns-platform-declarations": "6.0.1",
"typescript": "3.4.5"
}
```

Laravel mix always undefined in mix v4+

Any call to npm run after upgrading to Mix v4.x results in mix being undefined. I see errors like this on every run:
> npm run development
> # development /project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
/project/node_modules/webpack-cli/bin/cli.js:235
throw err;
^
TypeError: Cannot read property 'js' of undefined
at Object.<anonymous> (/project/webpack.mix.js:15:5)
at Module._compile (/project/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/project/node_modules/laravel-mix/setup/webpack.config.js:12:1)
at Module._compile (/project/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (/project/node_modules/webpack-cli/bin/convert-argv.js:113:13)
at requireConfig (/project/node_modules/webpack-cli/bin/convert-argv.js:115:6)
at /project/node_modules/webpack-cli/bin/convert-argv.js:122:17
at Array.forEach (<anonymous>)
at module.exports (/project/node_modules/webpack-cli/bin/convert-argv.js:120:15)
at yargs.parse (/project/node_modules/webpack-cli/bin/cli.js:232:39)
at Object.parse (/project/node_modules/yargs/yargs.js:567:18)
at /project/node_modules/webpack-cli/bin/cli.js:210:8
at Object.<anonymous> (/project/node_modules/webpack-cli/bin/cli.js:500:3)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/project/node_modules/webpack/bin/webpack.js:155:2)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I'm running this with Laravel 5.5. I upgraded package.json to match the version in the laravel repo that is used with mix v4.
Here is my package.json:
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"accounting": "^0.4.1",
"axios": "^0.18.0",
"bootstrap": "^4.1.3",
"bootstrap-sass": "^3.4.0",
"cross-env": "^5.2.0",
"fancybox": "^3.0.1",
"jquery": "^3.3.1",
"jquery-slimscroll": "^1.3.8",
"ladda": "^2.0.1",
"laravel-mix": "^4.0.13",
"locutus": "^2.0.10",
"metismenu": "^2.7.9",
"moment": "^2.23.0",
"vue": "^2.5.21",
"webpack": "^4.28.3",
"webpack-cli": "^3.2.0"
},
"dependencies": {
"ajv": "^6.6.2",
"bootstrap-vue": "^2.0.0-rc.11",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"imagemin": "^6.0.0",
"jsonexport": "^2.4.1",
"laravel-echo": "^1.5.2",
"lodash": "^4.17.11",
"node-sass": "^4.11.0",
"pusher-js": "^4.3.1",
"sweetalert2": "^7.32.4",
"vue-api-query": "^1.2.0",
"vue-events": "^3.1.0",
"vue-multiselect": "^2.1.3",
"vue-sweetalert2": "^1.6.3",
"vuetable-2": "^2.0.0-beta.4",
"vuex": "^3.0.1"
}
}
My webpack.mix.js:
const { mix } = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.version()
.sourceMaps();
I've tried deleting node_modules and yarn install again but that doesn't fix it.
If I downgrade to v3, there are no issues other than problems compiling some SASS.
npm v6.4.1
node v11.5.0
yarn v1.12.3
Without seeing your webpack.mix.js file it's hard to say what the problem could be. I cloned the Laravel 5.5 branch and upgraded to version ^4.0.13 of laravel-mix and successfully ran both yarn dev and yarn prod, although I am using more recent versions of npm and node.
NPM 6.5.0-next.0
Node 11.6.0
Yarn 1.12.3
Here's a GitHub repo to demo.
Update
// TypeError: Cannot read property 'js' of undefined
const { mix } = require('laravel-mix');
// works
const mix = require('laravel-mix');

Gulp: Cannot find module 'laravel-elixir-vue-2'

I get this error when I try to use gulp in my Laravel project. I tried deleting node_modules and running npm install, but no lock.
λ gulp
module.js:471
throw err;
^
Error: Cannot find module 'laravel-elixir-vue-2'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\wamp64\www\ibpc\gulpfile.js:3:1)
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)
I also tried to add it to package.json.
package.json
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"devDependencies": {
"bootstrap-sass": "^3.3.7",
"gulp": "^3.9.1",
"jquery": "^3.1.0",
"laravel-elixir": "^6.0.0-9",
"laravel-elixir-webpack-official": "^1.0.2",
"lodash": "^4.16.2",
"vue": "^2.0.1",
"vue-resource": "^1.0.3"
}
}
Any ideas?
Probably, you don't have laravel-elixir-vue-2 in your package.json file.
Try to install package with the next command:
npm install laravel-elixir-vue-2 --save-dev
Or add in your package.json this line:
"laravel-elixir-vue-2": "^0.3.0"
I've got same problem.
I tried to run this command
npm install laravel-elixir-webpack-official
And it fixed...

Add React Component to Laravel

I'm new to Laravel and react and I just wanted to use react component along side with Laravel. I followed the process described here but when I run gulp watch I get this error:
C:\wamp64\www\laravel51\node_modules\laravel-elixir-webpack-react\main.js:3
Elixir.ready(function() {
^
TypeError: Elixir.ready is not a function
at Object.<anonymous> (C:\wamp64\www\laravel51\node_modules\laravel-elixir-webpack-react\main.js:3:8)
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 Object.<anonymous> (C:\wamp64\www\laravel51\gulpfile.js:23:1)
at Module._compile (module.js:570:32)
I also run command npm install --save-dev laravel-elixir-webpack-react but get same error.
my package.json file is:
{
"private": true,
"devDependencies": {
"gulp": "^3.8.8",
"laravel-elixir-webpack-official": "^1.0.10",
"laravel-elixir-webpack-react": "^1.0.1",
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"dependencies": {
"laravel-elixir": "^4.0.0",
"bootstrap-sass": "^3.0.0"
}
}
my gulpfile is:
var elixir = require('laravel-elixir');
require('laravel-elixir-webpack-react');
elixir(function(mix) {
mix.webpack('app.js');
});
and I work with Laravel 5.1 in windows.

Resources