I am new to laravel, I am trying to use vue.js in laravel 9 and I followed step by step video guidance for exactly laravel 9 and in the last step you should type npm run watch in terminal and I get
watch
webpack --watch --progress
assets by status 0 bytes [cached] 1 asset
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in main
Module not found: Error: Can't resolve './src' in '/root/PhpstormProjects/eshop'
resolve './src' in '/root/PhpstormProjects/eshop'
using description file: /root/PhpstormProjects/eshop/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: /root/PhpstormProjects/eshop/package.json (relative path: ./src)
no extension
Field 'browser' doesn't contain a valid alias configuration
/root/PhpstormProjects/eshop/src doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/root/PhpstormProjects/eshop/src.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/root/PhpstormProjects/eshop/src.json doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/root/PhpstormProjects/eshop/src.wasm doesn't exist
as directory
/root/PhpstormProjects/eshop/src doesn't exist
webpack 5.73.0 compiled with 1 error and 1 warning in 134 ms
Anybody knows why?
Related
When I use php artisan command, it display "return [];"
Here is a screenshot
Above the header of my web page there is "return []"; too. Does anyone know what this is caused by?
A Laravel configuration file is a PHP file that contains an array, when your application is initialised Laravel loads each configuration file (config/*.php) and adds the array to your configuration.
The problem you're experiencing appears to be due to the fact that your application has a configuration file that is being loaded not as PHP but instead as a text file. This can be caused by a config file missing the opening <?php, which is required for the file to be treated as PHP. For example, if you create a file in config called example.php with the following contents:
return [
];
You would see the behaviour you're experiencing in the screenshot. Therefore you should visit your config directory and identify any file that is missing the opening <?php.
I am trying to use Angular as frontend and Laravel as backend and I have created my Angular project with lazy loaded modules and used webpack to do so.
However, when I use my webpack-dev-server the lazy loading works find and when I use my build files and serve using Laravel it throws the error like this
Uncaught SyntaxError: Unexpected token <
Error: Loading chunk 0 failed.
at HTMLScriptElement.onScriptComplete (polyfills.js:104) [angular]
at HTMLScriptElement.wrapFn (polyfills.js:8558) [angular]
at Object.onInvokeTask (app.js:4091) [angular]
The chunk generation works fine. It generates files like 0.chunk.js and on...
Thanks
The other build files used the path to assets,
So added that same path for chunk file generation in the webpack.config.js. I thought the path property used for all the generated file.
the code goes like this.
output: {
filename: '[name].js',
chunkFilename: '[id].chunk.js',
publicPath: 'assets/',
path: path.resolve(__dirname, 'assets/')
}
I'm stuck with my angular fire-2 offline/ionic3 app. it keeps giving me this error when I try to upload my app to ionic view. it has no errors when I build for Android nor when I use ionic lab.
I saw that other people have a polyfill problem and they suggest doing:
npm install promise-polyfill --save-exact
but it does not work for me, the error is still there. these are my versions (package.json):
"firebase": "^4.3.0",
"angularfire2": "^4.0.0-rc0",
"angularfire2-offline": "^4.2.4",
Error: ./node_modules/firebase/utils/promise.js Module not found: Error: Can't resolve 'promise-polyfill' in
remote: '/usr/src/app/node_modules/firebase/utils' resolve 'promise-polyfill' in
remote: '/usr/src/app/node_modules/firebase/utils' Parsed request is a module using description file:
remote: /usr/src/app/node_modules/firebase/package.json (relative path: ./utils) Field 'browser' doesn't contain a
remote: valid alias configuration after using description file: /usr/src/app/node_modules/firebase/package.json
remote: (relative path: ./utils) resolve as module looking for modules in /usr/src/app/node_modules using
remote: description file: /usr/src/app/package.json (relative path: ./node_modules) Field 'browser' doesn't contain
remote: a valid alias configuration after using description file: /usr/src/app/package.json (relative path:
remote: ./node_modules) using description file: /usr/src/app/package.json (relative path:
remote: ./node_modules/promise-polyfill) no extension Field 'browser' doesn't contain a valid alias configuration
remote: /usr/src/app/node_modules/promise-polyfill doesn't exist .ts Field 'browser' doesn't contain a valid alias
remote: configuration /usr/src/app/node_modules/promise-polyfill.ts doesn't exist .js Field 'browser' doesn't
remote: contain a valid alias configuration /usr/src/app/node_modules/promise-polyfill.js doesn't exist .json Field
remote: 'browser' doesn't contain a valid alias configuration /usr/src/app/node_modules/promise-polyfill.json
remote: doesn't exist as directory /usr/src/app/node_modules/promise-polyfill doesn't exist
remote: [/usr/src/app/node_modules/promise-polyfill] [/usr/src/app/node_modules/promise-polyfill.ts]
remote: [/usr/src/app/node_modules/promise-polyfill.js] [/usr/src/app/node_modules/promise-polyfill.json]
remote: [/usr/src/app/node_modules/promise-polyfill] # ./node_modules/firebase/utils/promise.js 14:76-103 #
remote: ./node_modules/firebase/app/firebase_app.js # ./node_modules/firebase/app.js #
remote: ./node_modules/firebase/firebase-browser.js # ./src/providers/camera/camera.ts # ./src/app/app.module.ts #
remote: ./src/app/main.ts
npm install angularfire2 firebase promise-polyfill --save
angularfire2 has updated their docs.
https://github.com/angular/angularfire2/blob/master/docs/Auth-with-Ionic3-Angular4.md
I have the exact same error after installing angularfire2 to my app; only when pushing the code to ionic pro platform.
First I had the error building for ios as well, that got away by updating angularfire2 to another version :
npm i --save angularfire2#4.0.0-rc.1
Maybe you can try that ?
I just run
composer update
but I got this
Failed loading ./opcache.so: ./opcache.so: cannot open shared object file: No such file or directory
PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './calendar.so' - ./calendar.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './ctype.so' - ./ctype.so: cannot open shared object file: No such file or directory in Unknown on line 0
... so on
I run php -i and got this
Loaded Configuration File => /etc/php/7.0/cli/php.ini
Scan this dir for additional .ini files => /etc/php/7.0/cli/conf.d
Additional .ini files parsed => /etc/php/7.0/cli/conf.d/10-opcache.ini,
/etc/php/7.0/cli/conf.d/10-pdo.ini,
/etc/php/7.0/cli/conf.d/20-calendar.ini,
/etc/php/7.0/cli/conf.d/20-ctype.ini,
... so on
How do I fix it?
Thanks in Advance.
Your php can not find the dlls. To solve it:
Run php -i and find your php.ini location under Loaded Configuration File key.
Search for the dll files php unable to load and find their full path
Update the extension key in your php.ini to the full dll path
for example:
extension=<path>/php_pdo_firebird.dll
extension=<path>/php_pdo_mysql.dll'
extension=<path>/php_pdo_pgsql.dll:
composer use php.ini in /etc/php/7.0/cli/php.ini looks like you uncoment extension_dir
just comment, and reload apache and you done it.
I was trying to publish my new laravel project using Forge+DigitalOcean but I get the error message (We were unable to install a project on your server) due to php artisan optimize command returning Invalid filename provided. error.
So I modified my .env file and set APP_DEBUG to false and tried to run the command locally. I got the following error:
php artisan optimize -v
Generating optimized class loader Compiling common classes
[RuntimeException] Invalid filename provided.
Exception trace: () at /home/bubut/Code/TalalAttendance/vendor/classpreloader/classpreloader/src/ClassPreloader.php:105
ClassPreloader\ClassPreloader->getCode() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:89
Illuminate\Foundation\Console\OptimizeCommand->compileClasses() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:70
Illuminate\Foundation\Console\OptimizeCommand->fire() at n/a:n/a
call_user_func_array() at
/home/bubut/Code/TalalAttendance/bootstrap/cache/compiled.php:1138
Illuminate\Container\Container->call() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Command/Command.php:258
Symfony\Component\Console\Command\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:827
Symfony\Component\Console\Application->doRunCommand() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:191
Symfony\Component\Console\Application->doRun() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:122
Symfony\Component\Console\Application->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:100
Illuminate\Foundation\Console\Kernel->handle() at
/home/bubut/Code/TalalAttendance/artisan:36
Laravel allows you to specify additional files to be compiled -- generally files that are used on every request in the application.
The file list is specified in /config/compile.php in the files array. If you have specified a file there but it does not exist (or the location is wrong) then artisan will throw that error when trying to compile it.
Same thing happened to me and removing the non-existent file from the list fixed my problem.
Same issue toady, and after debugging in Illuminate\Foundation\Console\OptimizeCommand, I found that some symfony components missing in vendor folder, even with composer install/update command for some reason.
Remove contents under vendor folder, then do composer update to see if missing components back. Or git clone whole project and composer update. Note that composer install will check composer.lock, if it existing and components missing there, issue triggered.
Note: For additional information
If your files are in a folder inside app folder, this is how you should list them.
'files' => [
'app/your_folder_name/file_a.php',
'app/your_folder_name/file_b.php',
'app/your_folder_name/file_c.php',
]
Hope this helps anyone who one to compile their custom functions.