cross-env: Permission denied when deploy docker on container-optimized-os - laravel

First I deployed my laravel project on google container-optimized-os.
And I have created the build by running:
docker-compose up -d
After it has finished to go into app container and I run:
docker exec -it app bash
I then run:
npm install
and
npm run dev
and finally I get this error:
npm WARN npm npm does not support Node.js v10.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
# dev /var/www
npm run development
npm WARN npm npm does not support Node.js v10.19.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
# development /var/www
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
sh: 1: cross-env: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
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 126
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/2020-05-10T15_35_07_179Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! # dev: `npm run development`
npm ERR! Exit status 126
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/2020-05-10T15_35_07_203Z-debug.log
I copy docker-compos.yml and Dockerfile from https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose
and edit Dockerfile for install nodejs and npm
Thanks.

Related

Laravel8 npm run dev outputs: ERESOLVE unable to resolve dependency tree

Goal
Avoid error message.
I have been getting the following error message when I run the command npm run dev:
npm notice
npm notice New major version of npm available! 7.6.1 -> 8.1.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.4
npm notice Run npm install -g npm#8.1.4 to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: acorn#7.4.1
npm ERR! node_modules/acorn
npm ERR! acorn#"^7.0.0" from acorn-node#1.8.2
npm ERR! node_modules/acorn-node
npm ERR! acorn-node#"^1.6.1" from detective#5.2.0
npm ERR! node_modules/detective
npm ERR! detective#"^5.2.0" from tailwindcss#2.2.19
npm ERR! node_modules/tailwindcss
npm ERR! dev tailwindcss#"^2.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional acorn#"^8.5.0" from terser#5.10.0
npm ERR! node_modules/terser
npm ERR! terser#"^5.9.0" from laravel-mix#6.0.39
npm ERR! node_modules/laravel-mix
npm ERR! dev laravel-mix#"^6.0.6" from the root project
npm ERR! terser#"^5.7.2" from terser-webpack-plugin#5.2.5
npm ERR! node_modules/terser-webpack-plugin
npm ERR! terser-webpack-plugin#"^5.2.4" from laravel-mix#6.0.39
npm ERR! node_modules/laravel-mix
npm ERR! dev laravel-mix#"^6.0.6" from the root project
npm ERR! 1 more (webpack)
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/ml/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ml/.npm/_logs/2021-12-02T07_41_55_149Z-debug.log
Quick Solution:
I can avoid the problem / error message with the following command:
npm install --legacy-peer-deps.
Output:
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
added 807 packages, and audited 808 packages in 12s
84 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Question
What do I have to do to run npm install again without getting the error message?
I have the same issue too. I have fixed it using this line
npm i acorn --dev
then run again
npm install && install run dev
npm install npm#latest -g
then
npm install webpack-dev-server --save-dev
working for me
If you are using Laravel Homestead Package for any Vagrant Environment, then don't run the command inside the Vagrant Project Directory.
Go outside to the local directory of the project and run these commands.
image of commands inside vagrant
You should run these here::
image of commands outside vagrant

Error installing Jetstream Livewire Basic Authentication on Laravel 8

I am trying to do a fresh install of Laravel 8 with Livewire basic authentication. Basic Laravel installs fine but when installing Jetstream and running "npm install && npm run dev", I get the error.
I found this link where it indicates that there is a problem with laravel mix:
https://laravel-mix.com/docs/5.0/installation
where says:
You won't find a webpack.config.js file in your project root. By default, Laravel defers to the config file from this repo. However, should you need to configure it, you may copy the file to your project root, and then update your package.json NPM scripts accordingly: cp node_modules/laravel-mix/setup/webpack.config.js ./.
but I don't understand exactly what I have to do.
update your package.json with what ??
Copy the webpack.config.js file to the project's root folder, rerun npm install and npm run dev and the problem persists.
The server is Centos7. I will appreciate help with the problem as I am absolutely stuck with this issue.
I'm about to go to Taylor's house to ask for an explanation! Thanks!
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js
/home/myproyect/public_html/proyect/proyectlar/node_modules/cross-env/src/index.js:23
)
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/myproyect/public_html/proyect/proyectlar/node_modules/cross-env/src/bin/cross-env.js:3:18)
npm ERR! Linux 3.10.0-1160.6.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "development"
npm ERR! node v6.17.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
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 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/myproyect/public_html/proyect/proyectlar/npm-debug.log
npm ERR! Linux 3.10.0-1160.6.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v6.17.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script 'npm run development'.
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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run development
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/myproyect/public_html/proyect/proyectlar/npm-debug.log
Update you npm and nodejs.
I had the same problem, and after update them, it works.
npm - 6.14.8
node - 14.15.1

npm run dev install errors on VM with laravel 5.4

I am trying to start using npm and vue for my front end development but having such a hard time starting. I am using scotchbox pro which is just a Vagrant box for development. I am running this VM on windows 10 and have a fresh install of laravel 5.4.
The default package.json is there (https://github.com/laravel/laravel/blob/master/package.json) and I have been trying to run npm install on the with no success for the last few days.
I am not sure where I should be looking for support on this issue since it could be laravel, npm, or my VM. It is so difficult for me to find a solid resource on how to get up and running!
Here is the npm run dev output that I get:
# dev /var/www
npm run development
# development /var/www
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress -hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
sh: 1: cross-env: not found
npm ERR! Linux 4.4.0-75-generic
npm ERR! argv "/home/vagrant/.nvm/versions/node/v6.10.3/bin/node" "/home/vagrant/.nvm/versions/node/v6.10.3/bin/npm" "run" "development"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
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! spawn ENOENT
npm ERR!
npm ERR! Failed at the # development script '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! 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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! 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! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/npm-debug.log
npm ERR! Linux 4.4.0-75-generic
npm ERR! argv "/home/vagrant/.nvm/versions/node/v6.10.3/bin/node" "/home/vagrant/.nvm/versions/node/v6.10.3/bin/npm" "run" "dev"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script 'npm run development'.
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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run development
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/npm-debug.log
I found that changing my Vagrant file configuration fixed this issue as it was a folder permission issue.
config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }

npm runs dev and npm runs watch error in laravel vue.js

npm runs dev and npm runs watch error this
Sombody can help me ?
node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
sh: 1: node_modules/cross-env/bin/cross-env.js: not found
npm ERR! Linux 4.10.0-40-generic
npm ERR! argv "/home/miftah/.nvm/versions/node/v6.11.1/bin/node" "/home/miftah/.nvm/versions/node/v6.11.1/bin/npm" "run" "dev"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! # dev: `node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the # dev script 'node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/html/saranabelanja/npm-debug.log
Try reinstalling your project specific NodeJS modules:
Deleting node_modules directory rm -r node_modules and
package-lock.json rm package-lock.json
Reinstalling packages npm install (using package.json)
When you don't have a package.json, you have to know what to reinstall and install them one by one. You may use options --save and --save-dev in the future...
When working with Docker and steps above fail, you may also try one of these:
Rebuilding docker container
Restarting Docker
Restarting Windows

Laravel 5.5 + Vue.js 2.x project not working on npm run dev

when I have created the new project for Laravel 5.5 + Vue.js 2.x , I have the problem. This is the message after I have run this.
npm install
npm run dev
> # dev /Volumes/Work/Work/Vue/CRUD
> npm run development
> # development /Volumes/Work/Work/Vue/CRUD
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
95% emitting
DONE Compiled successfully in 2830ms 6:01:15 PM
internal/child_process.js:325
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at _errnoException (util.js:1041:11)
at ChildProcess.spawn (internal/child_process.js:325:11)
at exports.spawn (child_process.js:493:9)
at Object.exports.execFile (child_process.js:208:15)
at Object.module.exports.fileCommand (/Volumes/Work/Work/Vue/CRUD/node_modules/node-notifier/lib/utils.js:53:13)
at NotificationCenter.notify (/Volumes/Work/Work/Vue/CRUD/node_modules/node-notifier/notifiers/notificationcenter.js:66:11)
at module.exports.WebpackNotifierPlugin.compilationDone (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack-notifier/index.js:62:18)
at Compiler.applyPlugins (/Volumes/Work/Work/Vue/CRUD/node_modules/tapable/lib/Tapable.js:61:14)
at emitRecords.err (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack/lib/Compiler.js:268:11)
at Compiler.emitRecords (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack/lib/Compiler.js:375:38)
at emitAssets.err (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack/lib/Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack/lib/Compiler.js:368:12)
at next (/Volumes/Work/Work/Vue/CRUD/node_modules/tapable/lib/Tapable.js:218:11)
at Compiler.compiler.plugin (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/Volumes/Work/Work/Vue/CRUD/node_modules/tapable/lib/Tapable.js:222:13)
at Compiler.afterEmit (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack/lib/Compiler.js:365:9)
at require.forEach.err (/Volumes/Work/Work/Vue/CRUD/node_modules/webpack/lib/Compiler.js:354:15)
at /Volumes/Work/Work/Vue/CRUD/node_modules/async/dist/async.js:421:16
at iteratorCallback (/Volumes/Work/Work/Vue/CRUD/node_modules/async/dist/async.js:998:13)
at /Volumes/Work/Work/Vue/CRUD/node_modules/async/dist/async.js:906:16
at /Volumes/Work/Work/Vue/CRUD/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:135:15)
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/paladin2/.npm/_logs/2017-09-04T08_01_15_242Z-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! /Users/paladin2/.npm/_logs/2017-09-04T08_01_15_321Z-debug.log
Has anybody had the same problem in the past?
giving your user execute rights on node_modules does the trick: chmod -R u+x node_modules/
if npm update doesn't work try installing webpack manually by command.
npm install –save-dev npm-install-webpack-plugin
I had the same issue since this morning and I remembered that I updated my npm version lately.
EVen if I created a new project and ran
npm install && npm run dev
I got the same issue.
A temporary solution for me is/was to downgrade npm:
npm install -g npm#5.3
If I now run npm run dev everything works fine.
that issue cause of permission of that folder, I think.
when I set folder permission like this, all works fine on my computer.
chmod -R 765 [foldername]
Thanks.
I've installed without laragon or Virtual host. Got the same error that cross-env is not found.
After the hours of research I found the solution. Here is how I did:
npm install cross-env -g
npm update
npm install --save
after that npm run dev or npm run build
Boom! Laravel Mix Build Successful it is working.....

Resources