yarn run dev - cross-env: Permission denied
Asked Answered
J

2

8

My dev environment is Vagrant ScotchBox, Node 6.6.2, Npm 3.9.5.

I'm trying to compile the assets of my Laravel project using Mix.

yarn install
yarn run dev

With yarn run dev i get sh: 1: cross-env: Permission denied

sh: 1: cross-env: Permission denied

npm ERR! Linux 3.13.0-55-generic
npm ERR! argv "/home/vagrant/.nvm/versions/node/v6.2.2/bin/node" "/home/vagrant/.nvm/versions/node/v6.2.2/bin/npm" "run" "development"
npm ERR! node v6.2.2
npm ERR! npm  v3.9.5
npm ERR! code ELIFECYCLE
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 '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/public/your-weedelivero/npm-debug.log
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c npm run development
Directory: /var/www/public/your-weedelivero
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/var/www/public/your-weedelivero/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Please, someone can help me?

Regards

/////////////////

maybe my package.json is wrong

{
    "private": true,
    "scripts": {

        "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",
          "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",
          "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 --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 --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"

    },
    "devDependencies": {
        "axios": "^0.17",
        "bootstrap-sass": "^3.3.7",
        "cross-env": "^5.1.3",
        "jquery": "^3.2",
        "laravel-mix": "^1.0",
        "lodash": "^4.17.4",
        "vue": "^2.5.7"
    }
}
Jailbreak answered 8/3, 2018 at 15:8 Comment(2)
I'd first try deleting your node_modules directory and running the install again. There's not a lot that can go wrong with the .json file, unless you've got syntax issues. If that fails you could try an nom rebuild on the package that's complaining, if supported. Also, what's the output of the command if you run it directly in the CLI yourself?Hilaria
Solved now! i runned "yarn run dev" directly from my computer (mac osx)Jailbreak
A
14

I Had this problem in my ubuntu 16.04.

for me, it fixes the problem

first, get into your directory in terminal and enter below command.

npm rebuild
Arborvitae answered 9/7, 2019 at 9:41 Comment(1)
Thanks, this fixed my issue on Ubuntu 18.04.3Subjunctive
R
0

I just remove the Nodejs and install the latest version of Nodejs and now I don't have this problem anymore Laravel Mix "sh: 1: cross-env: not found error"

Rennin answered 8/10, 2020 at 6:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.