My vue.js + Sails.js app won't run on Heroku - heroku

I've created a web app (Vue JS frontend, Sails JS backend) that runs fine on my local server. However, when I try to run it, I get errors; mostly dependency errors. I've deployed it on Heroku. I had to create a package.json file in the root of my app folder.
Here's what the app tree looks like:
root folder
|---frontend
|---package.json file
|---backend
|---package.json file
|---package.json file
I created the frontend app with vue cli webpack.
"name": "zigy-demo-store",
"version": "1.0.0",
"description": "A demo online store with Admin functions.",
"main": "backend/app.js",
"scripts": {
"dev": "cd backend && npm i && npm run dev & cd frontend && npm i && npm run build",
"start": "cd backend && npm i && npm run dev & cd frontend && npm i && npm start"
},
"dependencies": {
"sails": ""
},
"repository": {
"type": "git",
},
"engines": {
"node": "^10.15",
"npm": "6.7.0"
}
}
Here are some errors
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/home/adesuwa/.npm-global/bin/npm', 'start' ]
2 info using npm#6.7.0
3 info using node#v10.15.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle zigy-demo-store#1.0.0~prestart: zigy-demo-store#1.0.0
6 info lifecycle zigy-demo-store#1.0.0~start: zigy-demo-store#1.0.0
7 verbose lifecycle zigy-demo-store#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle zigy-demo-store#1.0.0~start: PATH: /home/adesuwa/.npm-global/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/media/adesuwa/Files/Programming/Dev test/zigy-demo-store/node_modules/.bin:/home/adesuwa/dart-sass/:/home/adesuwa/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle zigy-demo-store#1.0.0~start: CWD: /media/adesuwa/Files/Programming/Dev test/zigy-demo-store
10 silly lifecycle zigy-demo-store#1.0.0~start: Args: [ '-c',
10 silly lifecycle 'cd backend && npm i && npm run dev & cd frontend && npm i && npm start' ]
11 silly lifecycle zigy-demo-store#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle zigy-demo-store#1.0.0~start: Failed to exec start script
13 verbose stack Error: zigy-demo-store#1.0.0 start: `cd backend && npm i && npm run dev & cd frontend && npm i && npm start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/adesuwa/.npm-global/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/home/adesuwa/.npm-global/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid zigy-demo-store#1.0.0
15 verbose cwd /media/adesuwa/Files/Programming/Dev test/zigy-demo-store
16 verbose Linux 4.15.0-45-generic
17 verbose argv "/usr/bin/node" "/home/adesuwa/.npm-global/bin/npm" "start"
18 verbose node v10.15.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error zigy-demo-store#1.0.0 start: `cd backend && npm i && npm run dev & cd frontend && npm i && npm start`
22 error Exit status 1
23 error Failed at the zigy-demo-store#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Looks to me to be a problem with your paths. In the error log I see that the chained command is:
cd backend && npm i && npm run dev & cd frontend && npm i && npm start
According to your tree structure there is no frontend directory inside backend directory, which makes cd frontend fail. Try adding a ../ in there to go up one level before you go into frontend:
cd backend && npm i && npm run dev & cd ../frontend && npm i && npm start

Ok so I just deployed the frontend and backend as separate apps on Heroku. I followed this tutorial for making a Vue.js + webpack deploy on Heroku: https://codeburst.io/quick-n-clean-way-to-deploy-vue-webpack-apps-on-heroku-b522d3904bc8
Instead of pushing the frontend folder though, I push only the dist/ folder located in the frontend folder. I followed the steps from the article except the git init part. I cd'ed into the dist folder and did my git init there instead.

Related

How do I have to set up some scripts on windows?

I'm currently using Cypress, and I would like to run some commands. However, I'm pretty new to Windows, and I'm having issues setting up the script to do the right thing.
"scripts": {
"clean:reports": "rm -r -fo cypress\\reports && mkdir cypress\\reports && mkdir cypress\\reports\\mochareports",
"pretest": "npm run clean:reports",
"scripts": "cypress run",
"combine-reports": "mochawesome-merge --reportDir cypress\\reports\\mocha > Cypress\\reports\\mochareports\\reports.json",
"generate-reports": "merge Cypress\\reports\\mochareports\\report.json -f report -o Cypress\\reports\\mochareports",
"posttest": "npm run combine-reports && npm run generate-report",
"test": "npm run scripts || npm run posttest"
}
Error message:
Cypress_Mocha#1.0.0 pretest C:\Users\aharo\Desktop\Automation\Cypress_Mocha
> npm run clean:reports
> Cypress_Mocha#1.0.0 clean:reports C:\Users\aharo\Desktop\Automation\Cypress_Mocha
> rmdir .\cypress\reports && mkdir cypress\reports && mkdir cypress\reports\mochareports
The system cannot find the file specified.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! Cypress_Mocha#1.0.0 clean:reports: `rmdir .\cypress\reports && mkdir cypress\reports && mkdir cypress\reports\mochareports`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the Cypress_Mocha#1.0.0 clean:reports 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\aharo\AppData\Roaming\npm-cache\_logs\2020-12-31T16_54_14_427Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! Cypress_Mocha#1.0.0 pretest: `npm run clean:reports`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the Cypress_Mocha#1.0.0 pretest 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\aharo\AppData\Roaming\npm-cache\_logs\2020-12-31T16_54_14_464Z-debug.log
Is it possible if someone can help me a little bit more to understand what I have to do differently?
If I take a look at the logs through CMD, this is what I have:
0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Users\\aharo\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'test' 1 verbose cli ] 2 info using npm#6.14.10 3 info using node#v15.5.0 4 verbose run-script [ 'pretest', 'test', 'posttest' ] 5 info lifecycle Cypress_Mocha#1.0.0~pretest: Cypress_Mocha#1.0.0 6 verbose lifecycle Cypress_Mocha#1.0.0~pretest: unsafe-perm in lifecycle true 7 verbose lifecycle Cypress_Mocha#1.0.0~pretest: PATH: C:\Users\aharo\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\aharo\Desktop\Automation\Cypress_Mocha\node_modules\.bin;C:\Python39\Scripts\;C:\Python39\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Git\cmd;C:\Users\aharo\AppData\Local\Microsoft\WindowsApps;C:\Users\aharo\AppData\Roaming\npm;C:\Users\aharo\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\aharo\AppData\Local\Yarn\bin 8 verbose lifecycle Cypress_Mocha#1.0.0~pretest: CWD: C:\Users\aharo\Desktop\Automation\Cypress_Mocha 9 silly lifecycle Cypress_Mocha#1.0.0~pretest: Args: [ '/d /s /c', 'npm run clean:reports' ] 10 silly lifecycle Cypress_Mocha#1.0.0~pretest: Returned: code: 2 signal: null 11 info lifecycle Cypress_Mocha#1.0.0~pretest: Failed to exec pretest script 12 verbose stack Error: Cypress_Mocha#1.0.0 pretest: `npm run clean:reports` 12 verbose stack Exit status 2 12 verbose stack at EventEmitter.<anonymous> (C:\Users\aharo\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16) 12 verbose stack at EventEmitter.emit (node:events:376:20) 12 verbose stack at ChildProcess.<anonymous> (C:\Users\aharo\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 12 verbose stack at ChildProcess.emit (node:events:376:20) 12 verbose stack at maybeClose (node:internal/child_process:1063:16) 12 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5) 13 verbose pkgid Cypress_Mocha#1.0.0 14 verbose cwd C:\Users\aharo\Desktop\Automation\Cypress_Mocha 15 verbose Windows_NT 10.0.18363 16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\aharo\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test" 17 verbose node v15.5.0 18 verbose npm v6.14.10 19 error code ELIFECYCLE 20 error errno 2 21 error Cypress_Mocha#1.0.0 pretest: `npm run clean:reports` 21 error Exit status 2 22 error Failed at the Cypress_Mocha#1.0.0 pretest script. 22 error This is probably not a problem with npm. There is likely additional logging output above.
23 verbose exit [ 2, true ]

unable to compile assets in production with npm run production

npm run production doesn't run successfully. I have tried to remove the node_modules folder and run npm install but nothing still.
I have also tried to uninstall and install npm from the system but I still am having the same issue.
But watch is running fine but not production.
production script does:
"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",
I am using npm version 6.7.0 and nodejs version 8.11.4
The script consoles the following error in the npm error log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'prod' ]
2 info using npm#6.7.0
3 info using node#v8.11.4
4 verbose run-script [ 'preprod', 'prod', 'postprod' ]
5 info lifecycle #~preprod: #
6 info lifecycle #~prod: #
7 verbose lifecycle #~prod: unsafe-perm in lifecycle true
8 verbose lifecycle #~prod: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/html/****/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
9 verbose lifecycle #~prod: CWD: /var/www/html/****
10 silly lifecycle #~prod: Args: [ '-c', 'npm run production' ]
11 silly lifecycle #~prod: Returned: code: 1 signal: null
12 info lifecycle #~prod: Failed to exec prod script
13 verbose stack Error: # prod: npm run production
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid #
15 verbose cwd /var/www/html/****
16 verbose Linux 4.18.0-11-generic
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "prod"
18 verbose node v8.11.4
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error # prod: npm run production
22 error Exit status 1
23 error Failed at the # prod script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I had same issue because I used to put MIX_SENTRY_DSN_PUBLIC in webpack like this (NOT WORKING):
mix.js('resources/js/app.js', process.env.MIX_SENTRY_DSN_PUBLIC/'public/js')
.sass('resources/sass/app.scss', process.env.MIX_SENTRY_DSN_PUBLIC/'public/css');
instead of:
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');

Attempt to deploy laravel 5.5 with Vue app on shared hosting -component does not update

I' m trying to deploy my Laravel App on shared hosting. I'm also using Vuejs. Almost everything works fine. Only problem is component which is not updating after change. I'm doing following steps:
Copy Laravel project (files) from localhost to shared hosting. Project is working (except vue)
Installation of nodejs in root directory (not in laravel folder). I use following commands:
2.1 wget -qO- https://cdn.rawgit.com/creationix/nvm/master/install.sh | bash
2.2 export NVM_DIR="$HOME/.nvm"
2.3 [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
2.4 [ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
2.5 nvm install node
2.6 nvm use node
Next I'm going to laravel folder and input npm run watch but I get an error. Below is the content of log of npm
0 info it worked if it ends with ok
1 verbose cli [ '/home/mojstrona/.nvm/versions/node/v10.10.0/bin/node',
1 verbose cli '/home/mojstrona/.nvm/versions/node/v10.10.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'watch' ]
2 info using npm#6.4.1
3 info using node#v10.10.0
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle #~prewatch: #
6 info lifecycle #~watch: #
7 verbose lifecycle #~watch: unsafe-perm in lifecycle true
8 verbose lifecycle #~watch: PATH: /home/mojstrona/.nvm/versions/node/v10.10.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/mojstrona/domains/moj.stronazen.pl/l55/node_modules/.bin:/home/mojstrona/.nvm/versions/node/v10.10.0/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/puppetlabs/bin:/home/mojstrona/.local/bin:/home/mojstrona/bin
9 verbose lifecycle #~watch: CWD: /home/mojstrona/domains/moj.stronazen.pl/l55
10 silly lifecycle #~watch: Args: [ '-c',
10 silly lifecycle 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle #~watch: Returned: code: 126 signal: null
12 info lifecycle #~watch: Failed to exec watch script
13 verbose stack Error: # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/home/mojstrona/.nvm/versions/node/v10.10.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/home/mojstrona/.nvm/versions/node/v10.10.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid #
15 verbose cwd /home/mojstrona/domains/moj.stronazen.pl/l55
16 verbose Linux 3.10.0-714.10.2.lve1.5.17.el7.x86_64
17 verbose argv "/home/mojstrona/.nvm/versions/node/v10.10.0/bin/node" "/home/mojstrona/.nvm/versions/node/v10.10.0/bin/npm" "run" "watch"
18 verbose node v10.10.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 126
22 error # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 126
23 error Failed at the # watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
I can solve this error using chmod -R a+x node_modules, bute I get next error
error in ./resources/assets/sass/app.scss
Module build failed: Error: Missing binding /home/mojstrona/domains/moj.stronazen.pl/l55/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x** Run `npm rebuild node-sass` to download the binding for your current environment.
So I'm restarting SSH and running npm rebuild node-sass without errors. Then I'm running npm run watch with any errors too, but the problem still exists. Components are not updated after changes even if I change component name. for example:
Before change in app.js
Vue.component('ex', require('./components/ExampleComponent.vue'));
Before change in components folder
ExampleComponent.vue
Displayed
ExampleComponent.vue
After change in app.js
Vue.component('ex', require('./components/ExampleComponent2.vue'));
After change in components folder
ExampleComponent2.vue
Displayed after change
ExampleComponent.vue
After change2 in app.js
Vue.component('ex', require('./components/ExampleComponent2.vue'));
After change2 in components folder
ExampleComponent3.vue
Displayed after change2
ExampleComponent.vue
Below is the screenshot of result of npm run commands.

Webpack watch script throws an error after couple successfull compiles.Laravel Homestead

Bundle compiles successfully couple of times but then i get this error:
Error:
95% emittingError: UNKNOWN: unknown error, open 'D:\Web Development\Projects\GUIRebuild\public\js\super_admin_bundle.js
'
at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules
--config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch 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\Smolen\AppData\Roaming\npm-cache\_logs\2017-12-01T05_07_28_612Z-debug.log
Log:
0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Smolen\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'watch' ]
2 info using npm#5.5.1
3 info using node#v6.11.3
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle #~prewatch: #
6 info lifecycle #~watch: #
7 verbose lifecycle #~watch: unsafe-perm in lifecycle true
8 verbose lifecycle #~watch: PATH: C:\Users\Smolen\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\Web Development\Projects\GUIRebuild\node_modules\.bin;%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;D:\HashiCorp\Vagrant\bin;D:\Program Files\Git\cmd;D:\Program Files\nodejs\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\ProgramData\chocolatey\bin;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;D:\Program Files (x86)\PuTTY\;C:\Users\Smolen\AppData\Local\atom\bin;C:\Users\Smolen\AppData\Roaming\npm;D:\Users\Smolen\AppData\Local\Android\sdk\platform-tools;
9 verbose lifecycle #~watch: CWD: D:\Web Development\Projects\GUIRebuild
10 silly lifecycle #~watch: Args: [ '/d /s /c',
10 silly lifecycle 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle #~watch: Returned: code: 1 signal: null
12 info lifecycle #~watch: Failed to exec watch script
13 verbose stack Error: # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\Smolen\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\Smolen\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:920:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid #
15 verbose cwd D:\Web Development\Projects\GUIRebuild
16 verbose Windows_NT 6.1.7601
17 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Smolen\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
18 verbose node v6.11.3
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the # watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I have no idea why is this happening, i am using vagrant and virtual box but this compiles on my machine not on the virtual one.I get this "Unknown error" on random files.
What i have tried:
Remove/Reinstall node_modules
Upgrade Node and NPM
Clear NPM cache
OS: Windows 7
Laravel: 5.4v
NPM: 5.5.1v
You can try removing node_modules folder and run again
npm install
In my case the output directory was corrupted and could not be opened anymore, so webpack could not access it.
Working around that by checking out the project in another location was the fastest solution, as deleting the directory was not easy and required repairing the drive with the windows repair tool (Right-Click in File Manager on Drive -> Properties -> Tools -> Disk Check).

Now is not recognized as an internal or external command - when attempting to host a page with Zeit

"scripts": {
"start-js": "react-scripts start",
"start": "npm-run-all -p watch-css start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"build-css": "node-sass-chokidar src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --
watch --recursive",
"now-start": "node server/server.js",
"deploy": "now --public --dotenv=.env.prod -d"
},
"now": {
"alias": "lendahand"
}
}
Greetings. I'm trying to host a project with Zeit but I am getting an error I don't know how to fix. The error is saying that now is not an internal or external command, but it appears to be showing up in my package.json. I don't know how to remedy this situation. Do you have any suggestions?
The error is:
persona-project2-front#0.1.0 deploy C:\Users\Kim\DevMountain\LendAHandPP
> now --public --dotenv=.env.prod -d
'now' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! persona-project2-front#0.1.0 deploy: `now --public --
dotenv=.env.prod -d`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the persona-project2-front#0.1.0 deploy 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\Kim\AppData\Roaming\npm-cache\_logs\2017-11-
06T23_38_07_616Z-debug.log
Add the directory that now exists in to your PATH/path environmental variable, then you can use now. Make sure to close and re-open your terminal for the env. var. to take effect.
If that's not working, first make sure to install now like this:
npm install now -g to install it globally in your global npm/node_modules directory.
Then test it.
Thirdly, if that is not working, it could be a problem with the environmental variable not being set, so you may need to get root/administrator access and set that in the PATH env var for your system. As for the terminal, maybe try opening your terminal with admin access, or if on linux try something like sudo now.
Finally, after doing your npm install now -g it should display some messages like
'... -> C:\Users\\AppData\Roaming\npm\node_modules\now\download\dist\now ...'
Use that directory to work with now. This would open now process inside your terminal, your directory to now may be different, make sure to set this directory in your PATH if possible.

Resources