I'm using Laravel 5.4 with vue.js . Then i had syntax error between created and methods. I forgot , then i fix this error.
But still the error continue.
<script>
export default {
data(){
return {
users: []
}
},
created(){
this.fetchUsers();
},//forgotten
methods:{ //41.line
fetchUsers(){
this.$http.get('/users').then(response => {
this.users = response.data.users;
});
}
}
}
</script>
I was restarted apache.But still have this error if i write "npm run dev" or "npm run watch".
error in ./resources/assets/js/components/Users.vue
Syntax Error: Unexpected token, expected , (41:4)
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! /home/ubuntu/.npm/_logs/2017-07-11T08_13_41_572Z-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! /home/ubuntu/.npm/_logs/2017-07-11T08_13_41_618Z-debug.log
EDIT
I listen your advice and applied.I mean the problem is not relevant syntax mistake.The problem is old code execute insead of new code.I saved all file and then "npm run dev" but return same error everytime.
Even I got the same error- A complete log of this run can be found in:
The problem is with the port number, go to package.json file and change the port number to anything you want, say 8000. For example:
"scripts": {
"build": "webpack --config webpack.prod.js --progress",
"watch": "npm run build -- --watch",
"server": "webpack-dev-server --inline --progress --port 8000 --content-base src",
"start": "npm run server"
}
Earlier the port number was 3000, and on npm start different application use to render on port 3000 so for my new application I gave port number 8000. Now I can have two different application on different ports (localhost:3000 and localhost:8000) without getting error.
Related
I have a problem installing my app on a new server, I come from centos6 to centos7.
When I am installing a Laravel app that works perfectly on centos6 it goes right except when I run npm run dev
[root#v6-a10 worknow4.0]# npm run dev
> 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
node:events:306
throw er; // Unhandled 'error' event
^
Error: spawn node_modules/webpack/bin/webpack.js EACCES
at Process.ChildProcess._handle.onexit (node:internal/child_process:269:19)
at onErrorNT (node:internal/child_process:467:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:275:12)
at onErrorNT (node:internal/child_process:467:16)
at processTicksAndRejections (node:internal/process/task_queues:80:21) {
errno: -13,
code: 'EACCES',
syscall: 'spawn node_modules/webpack/bin/webpack.js',
path: 'node_modules/webpack/bin/webpack.js',
spawnargs: [
'--progress',
'--hide-modules',
'--config=node_modules/laravel-mix/setup/webpack.config.js'
]
}
npm ERR! code 1
npm ERR! path /home/admin/domains/worknow-cursos.com/public_html/worknow4.0
npm ERR! command failed
npm ERR! command sh -c 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! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-07T19_56_43_919Z-debug.log
npm ERR! code 1
npm ERR! path /home/admin/domains/worknow-cursos.com/public_html/worknow4.0
npm ERR! command failed
npm ERR! command sh -c npm run development
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-07T19_56_44_006Z-debug.log
I have been searching for an answer for hours but nothing works.
I tried to delete node_modules and package-lock and reinstall, but also didn't work.
Ok the problem might be permission as dimitri says. I just go to node_modules/webpack/bin/webpack.js and change the permission to 777
I dont know if this is recomended but at least works
I'm stucked with this problem and I need to fix it already so any tips will be truly appreciated.
I've my project made with Laravel and Vue, with an image container in Docker. The app is hosted in AWS.
The problem I'm facing is that I can't deploy the app to production using the follow command: ssh ec2-user#13.58.231.51 'cd /var/www/mevym/; ./deploy.sh'
The curious part is that if I run npm run production it works perfectly fine.
I already tried every single solutions from similar threads, like this one: How to solve npm error "npm ERR! code ELIFECYCLE" but nothing worked for me.
This is my package.json:
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --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 --disable-host-check --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 --config=node_modules/laravel-mix/setup/webpack.config.js"
},
Just in case, here it's my webpack.mix.js:
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
require('postcss-import'),
require('tailwindcss'),
])
.webpackConfig(require('./webpack.config'));
.deploy.sh:
# Enter maintenance mode
(php artisan down --message 'The app is being (quickly!) updated. Please try again in a minute.') || true
# Update branch
git fetch --all
git reset --hard origin/main
# Make storage writable
sudo chmod -R 777 ./storage
# Install dependencies based on lock file
composer install --no-interaction --prefer-dist --optimize-autoloader
# JS dependencies
npm install
# Migrate database
php artisan migrate --force
# Compile assets
npm run prod
# Clear cache
php artisan optimize
# Reload PHP to update opcache
echo "" | sudo -S service php-fpm reload
# Exit maintenance mode
php artisan up
echo "Application deployed!"
And finally the error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # production 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! /home/ec2-user/.npm/_logs/2021-01-08T18_49_06_563Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # prod: `npm run production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Thanks in advance.
In case that anyone is just going through the same and checked every other alternatives here, it was a server memory problem. We just had to clean it and we were ready to keep it going. Apparently after several deploys it ran out of space.
Good morning, I am trying to make a deployment of a page developed in vue.js and I uploaded all the files and it works, I just need to run "npm run dev" but it throws me the following error. I already ran "npm install" delete package.json and the node_modules folders I ran everything from scratch again but it remains the same
> # dev /var/www/html
> npm run development
> # development /var/www/html
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js
21% building 95/96 modules 1 active .../dist/cjs.js??ref--5-5!/var/www/html/resources/sass/app.scssnpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --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.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-08T16_00_32_214Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
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! /root/.npm/_logs/2021-01-08T16_00_32_256Z-debug.log
Try to below way i hope it work
1. cmd -> npm cache clean
2. delete package.lock.json file
3. delete node module folder
4. cmd -> npm install
I have this in package.json file:
{
"name": "test demo",
"version": "1.0.0",
"description": "test demo scripts",
"scripts": {
"test:v1": "wdio src/resources/config/wdio.chrome.conf.js --spec test/Tests.spec.ts",
"test:v2": "wdio src/resources/config/wdio.firefox.conf.js --spec test/Tests.spec.ts",
"test": "npm run test:v1 && npm run test:v2"
},
...
}
When run this command:
npm run test
then if test:v1 fails, then test:v2 script is not executed at all.
Is there a way to configure this so that all scripts run regardless if some of them failed?
EDIT:
When I try this in package.json:
"test": "npm run test:v1 ; npm run test:v2"
Then I still don't get both scripts executed, just test:v1 gets executed with error.
This is what I get in the console:
C:\2020\demo>npm run test
> demo#1.0.0 test C:\2020\demo
> npm run test:v1 ; npm run test:v2
> demo#1.0.0 test:v1 C:\2020\demo
> wdio src/resources/config/wdio.chrome.conf.js --spec test/Tests.spec.ts ";"
"npm" "run" "test:v2"
Execution of 1 spec files started at 2020-06-12T15:16:42.936Z
[0-0] RUNNING in chrome - C:\2020\demo\Tests.spec.ts
... other log with failing tests ...
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:27
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demo#1.0.0 test:v1: `wdio src/resources/config/wdio.chrome.conf.js --spec test/Tests.spec.ts ";" "npm" "run" "test:v2"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the demo#1.0.0 test:v1 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\<User>\AppData\Roaming\npm-cache\_logs\2020-06-
12T15_17_10_512Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demo#1.0.0 test: `npm run test:v1 ; npm run test:v2`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the demo#1.0.0 test 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\<User>\AppData\Roaming\npm-cache\_logs\2020-06-
12T15_17_10_548Z-debug.log
If I try like this in package.json:
"test": "npm run test:v1; npm run test:v2"
Then I get this in the console:
npm ERR! missing script: test:v1;
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! test:v1
npm ERR! test:v2
Thanks!
The solution for this differs depending on which OS you are using because NPM utilizes a different shell for running npm scripts.
On *nix, (Linux, macOS, etc..), the default shell that npm utilizes for running npm scripts is sh.
On Windows the default shell that npm utilizes for running npm scripts is cmd.exe.
Check which shell npm is using?
Using the npm config command you need to check the value of the script-shell setting. To do this you can run the following command:
npm config get script-shell
It will typically return/print either the pathname to cmd.exe or sh - depending on which OS your using.
Solution:
If you're running Windows and the default shell is cmd.exe
Then change your test script in package.json to the following:
"test": "npm run test:v1 & npm run test:v2"
Note the double ampersand (&&) has been replace with a single ampersand (&).
Or...
If you're running *nix and the default shell is sh
Then change your test script in package.json to the following:
"test": "npm run test:v1; npm run test:v2"
Note the double ampersand (&&) has been replace with a single semi-colon (;).
npm run test:v1; npm run test:v2
; means run the next command regardless of the success of the previous one.
&& means only run the next command if the previous one succeeded.
I recently installed node on my chromebook. I have git cloned a basic node repo that is trying to run things like webpack, babel-node, and concurrently through npm scripts.
However, running webpack (in the same directory) works just fine.
I have run "sudo chmod -R 777 my_app" and it did not help.
Here is the error message:
chronos#localhost ~/Downloads/MODULE $ npm start
> my-glitch-app#0.0.1 start /home/chronos/user/Downloads/MODULE
> concurrently "webpack -w -p" "babel-node server.js"
sh: concurrently: Permission denied
npm ERR! Linux 3.18.0-14875-g438cb8ab27c6
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! my-glitch-app#0.0.1 start: `concurrently "webpack -w -p" "babel-node server.js"`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the my-glitch-app#0.0.1 start script 'concurrently "webpack -w -p" "babel-node server.js"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the my-glitch-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! concurrently "webpack -w -p" "babel-node server.js"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs my-glitch-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-glitch-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/chronos/user/Downloads/MODULE/npm-debug.log
following my comment above, sudo mount -o remount,exec /home/chronos/user seemed to work, but i have further anomalies in my case, so i'd be curious about peer experience