纱线运行dev - cross-env:权限被拒绝

时间:2018-03-08 15:08:23

标签: node.js laravel npm yarnpkg laravel-mix

我的开发环境是Vagrant ScotchBox,节点6.6.2,Npm 3.9.5。

我正在尝试使用Mix编译Laravel项目的资产。

yarn install
yarn run dev

使用yarn run dev我得到 sh:1:cross-env:权限被拒绝



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.




拜托,有人可以帮帮我吗?

此致

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

也许我的package.json错了



{
    "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"
    }
}




2 个答案:

答案 0 :(得分:1)

我在Ubuntu 16.04中添加了此问题。

对我来说,它可以解决问题

首先,进入终端的目录并输入以下命令。

npm rebuild

答案 1 :(得分:0)

我只是删除了Nodejs并安装了最新版本的Nodejs,现在我不再有此问题了 Laravel Mix "sh: 1: cross-env: not found error"