npm run dev fails in fresh laravel project - laravel

NPM run dev fails in a new laravel project.
Its says its has problems in my resources\app.js but this file is empty :|
i tryed:
installing older npm version
installing babel version recommended by other questions
updating composer
Empty cach
rm -rf node_modules && npm cache clean --force && npm install
Here is the error in term:
> # dev /Users/sebastiantramper/code/uniekegerechten
> npm run development
> # development /Users/sebastiantramper/code/uniekegerechten
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
98% after emitting SizeLimitsPlugin
ERROR Failed to compile with 1 errors 16:39:49
error in ./resources/js/app.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Package exports for '/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/helper-compilation-targets' do not define a '.' subpath
at applyExports (internal/modules/cjs/loader.js:485:15)
at resolveExports (internal/modules/cjs/loader.js:508:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:577:20)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:879:27)
at Function.Module._load (internal/modules/cjs/loader.js:785:27)
at Module.require (internal/modules/cjs/loader.js:956:19)
at require (/Users/sebastiantramper/code/uniekegerechten/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/preset-env/lib/debug.js:8:33)
at Module._compile (/Users/sebastiantramper/code/uniekegerechten/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
at Module.load (internal/modules/cjs/loader.js:914:32)
at Function.Module._load (internal/modules/cjs/loader.js:822:14)
at Module.require (internal/modules/cjs/loader.js:956:19)
at require (/Users/sebastiantramper/code/uniekegerechten/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/preset-env/lib/index.js:11:14)
at Module._compile (/Users/sebastiantramper/code/uniekegerechten/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
at Module.load (internal/modules/cjs/loader.js:914:32)
at Function.Module._load (internal/modules/cjs/loader.js:822:14)
at Module.require (internal/modules/cjs/loader.js:956:19)
at require (/Users/sebastiantramper/code/uniekegerechten/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at requireModule (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/files/plugins.js:165:12)
at loadPreset (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/files/plugins.js:83:17)
at createDescriptor (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-descriptors.js:154:9)
at /Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-descriptors.js:109:50
at Array.map (<anonymous>)
at createDescriptors (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-descriptors.js:101:10)
at /Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-descriptors.js:58:104
at cachedFunction (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/caching.js:62:27)
at cachedFunction.next (<anonymous>)
at evaluateSync (/Users/sebastiantramper/code/uniekegerechten/node_modules/gensync/index.js:244:28)
at sync (/Users/sebastiantramper/code/uniekegerechten/node_modules/gensync/index.js:84:14)
at presets (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-descriptors.js:29:84)
at mergeChainOpts (/Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-chain.js:320:26)
at /Users/sebastiantramper/code/uniekegerechten/node_modules/#babel/core/lib/config/config-chain.js:283:7
# multi ./resources/js/app.js ./resources/sass/app.scss
Asset Size Chunks Chunk Names

After updating Node js it worked.

Related

How can I create a clean Laravel 7 install for dev that won't try to update modeules to v8?

Despite all the improvements that v8 has delivered I'm having some fun with livewire npm interacting with UI/bootstrap, such as:
```> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module './utils/constants'```
... and ...
```
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\xxxxxx\OneDrive\qqqq\xx\Laravel\login\node_modules\webpack\clibin\cli.js:8:34)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19) {
code: 'MODULE_NOT_FOUND',```
So, to my point, is there a way to install a clean Laravel 7 that remains blissfully ignorant of v8 and any related consequences (dependencies)?
Thanks.
How about checking the documentation? ;)
Via Composer Create-Project
Alternatively, you may also install Laravel by issuing the Composer
create-project command in your terminal:
composer create-project --prefer-dist laravel/laravel:^7.0 blog

Npm run dev fails on my laravel vue project

I am trying to run a laravel-vue application that was developed on mac using valet . When i imported the project on localhost, Npm run dev fails to compile my assets and shows the following error
ERROR Failed to compile with 1 errors 10:08:55 AM
error in ./resources/js/app.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in C:\xampp\htdocs\tapper\node_modules\#babel\helper-compilation-targets\package.json
at applyExports (internal/modules/cjs/loader.js:491:9)
at resolveExports (internal/modules/cjs/loader.js:507:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\xampp\htdocs\tapper\node_modules\#babel\preset-env\lib\debug.js:8:33)
at Module._compile (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\xampp\htdocs\tapper\node_modules\#babel\preset-env\lib\index.js:11:14)
at Module._compile (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at requireModule (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\files\plugins.js:165:12)
at loadPreset (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\files\plugins.js:83:17)
at createDescriptor (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:154:9)
at C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:109:50
at Array.map (<anonymous>)
at createDescriptors (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:109:29)
at createPresetDescriptors (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:101:10)
at C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:58:104
at cachedFunction (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\caching.js:62:27)
at cachedFunction.next (<anonymous>)
at evaluateSync (C:\xampp\htdocs\tapper\node_modules\gensync\index.js:244:28)
at sync (C:\xampp\htdocs\tapper\node_modules\gensync\index.js:84:14)
at presets (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:29:84)
at mergeChainOpts (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-chain.js:320:26)
at C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-chain.js:283:7
# multi ./resources/js/app.js ./resources/sass/app.scss
Asset Size Chunks Chunk Names
/css/app.css 196 KiB /js/app [emitted] /js/app
/js/app.js 7.89 KiB /js/app [emitted] /js/app
ERROR in ./resources/js/app.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main resolved in C:\xampp\htdocs\tapper\node_modules\#babel\helper-compilation-targets\package.json
at applyExports (internal/modules/cjs/loader.js:491:9)
at resolveExports (internal/modules/cjs/loader.js:507:23)
at Function.Module._findPath (internal/modules/cjs/loader.js:635:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\xampp\htdocs\tapper\node_modules\#babel\preset-env\lib\debug.js:8:33)
at Module._compile (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\xampp\htdocs\tapper\node_modules\#babel\preset-env\lib\index.js:11:14)
at Module._compile (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Module.require (internal/modules/cjs/loader.js:1026:19)
at require (C:\xampp\htdocs\tapper\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at requireModule (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\files\plugins.js:165:12)
at createDescriptors (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:109:29)
at createPresetDescriptors (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:101:10)
at C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:58:104
at cachedFunction (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\caching.js:62:27)
at cachedFunction.next (<anonymous>)
at evaluateSync (C:\xampp\htdocs\tapper\node_modules\gensync\index.js:244:28)
at sync (C:\xampp\htdocs\tapper\node_modules\gensync\index.js:84:14)
at presets (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-descriptors.js:29:84)
at mergeChainOpts (C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-chain.js:320:26)
at C:\xampp\htdocs\tapper\node_modules\#babel\core\lib\config\config-chain.js:283:7
# multi ./resources/js/app.js ./resources/sass/app.scss /js/app[0]
npm ERR! code ELIFECYCLE
npm ERR! errno 2
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 2
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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\tunne\AppData\Roaming\npm-cache\_logs\2020-07-13T07_08_55_699Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\tunne\AppData\Roaming\npm-cache\_logs\2020-07-13T07_08_55_779Z-debug.log
My question is, since the application was developed on mac and we are trying to run it on windows +xampp on locahost, could the environment configuration be the issue? if so, how do i solve it?
Let me add that the application runs perfectly fine on the staging site (laravel forge) so i donot think there is any error in the code.
Even composer install and composer update fail with "Your requirements could not be resolved to an installable set of packages". Can someone please tell me what the issue is

NPM: Unexpected identifier

I’m working on a small project with Laravel and VueJS, but I’m having some trouble with npm, when I want to run „npm run watch“ to test changes on a vue component. I’m running it all on Mac OS 10.14.6.
My node version is v6.11.2 and my npm version is 6.14.4.
This is the error I’m receiving:
/Applications/MAMP/htdocs/novellum/node_modules/chokidar/index.js:151
async remove(item) {
^^^^^^
SyntaxError: Unexpected identifier
at NativeCompileCache._moduleCompile (/Applications/MAMP/htdocs/novellum/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/Applications/MAMP/htdocs/novellum/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
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 (/Applications/MAMP/htdocs/novellum/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Applications/MAMP/htdocs/novellum/node_modules/sass/sass.dart.js:98:17)
at Module._compile (/Applications/MAMP/htdocs/novellum/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
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 (/Applications/MAMP/htdocs/novellum/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at implementation (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/Sass.js:55:27)
at implementation (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/Preprocessor.js:130:61)
at global.tap (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/helpers.js:10:5)
at Sass.loaderOptions (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/Preprocessor.js:128:9)
at extractPlugin (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/Preprocessor.js:87:39)
at global.tap (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/helpers.js:10:5)
at details.forEach (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/Preprocessor.js:27:13)
at Array.forEach (native)
at Sass.webpackRules (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/Preprocessor.js:22:22)
at ComponentFactory.applyRules (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/ComponentFactory.js:155:23)
at Mix.listen.rules (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/components/ComponentFactory.js:66:48)
at events.(anonymous function).forEach.handler (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/Dispatcher.js:34:47)
at Array.forEach (native)
at Dispatcher.fire (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/Dispatcher.js:34:28)
at Mix.dispatch (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/Mix.js:118:25)
at WebpackConfig.buildRules (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/builder/WebpackConfig.js:90:13)
at WebpackConfig.build (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/src/builder/WebpackConfig.js:23:14)
at Object.<anonymous> (/Applications/MAMP/htdocs/novellum/node_modules/laravel-mix/setup/webpack.config.js:29:38)
at Module._compile (/Applications/MAMP/htdocs/novellum/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (module.js:579:10)
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 "--watch"`
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.
Any suggestions what to do? I already deleted my node_modules folder, my package-lock.json and created it all new, uninstalled npm and reinstalled it via brew.
That's happening because your version of NodeJS don't support async/await calls. You must update your NodeJS to minimum 7.6, but I suggest using v12.x.x.
Check https://nodejs.org/en/ on how to download it and update on your operating system.

Project created with "tns create" give error with any "ng generate' command

Just trying to learn Nativescript using the Nativescript CLI and an Angular Framewok.
tns create myapp --ng
Then after answering the questions, I move on to:
ng generate --help
Which gives this error:
An unhandled exception occurred: Cannot find module '#schematics/angular/utility/config'
See "/tmp/ng-V5J95L/angular-errors.log" for further details.
The log file contains:
[error] Error: Cannot find module '#schematics/angular/utility/config'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/usr/lib/node_modules/#nativescript/schematics/src/angular-project-parser.js:6:18)
at Module._compile (internal/modules/cjs/loader.js:778: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)
npm i -D #nativescript/schematics
then
npm i -D #angular/cli
restart the terminal/ command line and then again
ng g c <Component/name>
The solution for me turned out be be because I had installed and was using version 12.x of Node.js, the fix was to use the Long Term Support (LTS) version 10.x of Node.js.

Error: Cannot find module './Assert' When Running npm run watch with Laravel

I randomly started getting this error message when I try to run npm run watch. I don't know what I did that would cause it to have an error since I never touched any of the files related to laravel-mix.
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
module.js:549
throw err;
^
Error: Cannot find module './Assert'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/node_modules/laravel-mix/src/Api.js:1:76)
at Module._compile (module.js:652:30)
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)
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 "--watch"`
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.
Tried running npm update and npm install to get the latest files but it didn't help.
I even tried manually adding the Assert.js file, but I kept getting new errors with each one that I fixed. There must be a better solution.
I deleted laravel-mix from node_modules and ran npm install again and it changed my error to:
Error: Cannot find module './transform'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/node_modules/ajv-keywords/keywords/index.js:18:14)
Ended up getting npm run watch to work by deleting the node_modules directory and running npm install to get all files fresh. Not sure why I had to delete the node_modules folder to get the fresh files, but at least its working.

Resources