我一直在尝试在我的项目上设置laravel mix并按照laravel网站上的安装指南进行操作,但不断出现错误。
我的package.json文件是
create table a (
a_id integer,
a_name varchar2(10),
PRIMARY KEY (a_id)
)
create table b(
b_id,
b_name varchar2(10),
a_id integer,
PRIMARY KEY (a_id),
FOREIGN KEY (a_id) REFERENCES a(a_id)
)
我运行任何npm run命令时得到的错误是
{
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack --progress --hide-modules",
"watch": "cross-env NODE_ENV=development webpack --watch --progress --hide-modules",
"hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot",
"production": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"devDependencies": {
"axios": "^0.15.2",
"bootstrap-sass": "^3.3.7",
"jquery": "^3.1.0",
"laravel-mix": "^0.4.0",
"lodash": "^4.16.2",
"vue": "^2.0.1"
},
"name": "Code",
"version": "1.0.0",
"main": "webpack.mix.js",
"directories": {
"test": "tests"
},
"dependencies": {
"ansi-regex": "^2.1.1",
"ansi-styles": "^2.2.1",
"axios": "^0.15.3",
"babel-core": "^6.24.1",
"babel-code-frame": "^6.22.0",
"babel-generator": "^6.24.1",
"babel-messages": "^6.23.0",
"babel-helpers": "^6.24.1",
"babel-register": "^6.24.1",
"babel-template": "^6.24.1",
"babylon": "^6.17.0",
"balanced-match": "^0.4.2",
"babel-runtime": "^6.23.0",
"babel-types": "^6.24.1",
"babel-traverse": "^6.24.1",
"brace-expansion": "^1.1.7",
"bootstrap-sass": "^3.3.7",
"chalk": "^1.1.3",
"convert-source-map": "^1.5.0",
"concat-map": "^0.0.1",
"core-js": "^2.4.1",
"cross-env": "^3.2.4",
"detect-indent": "^4.0.0",
"esutils": "^2.0.2",
"escape-string-regexp": "^1.0.5",
"follow-redirects": "^1.0.0",
"globals": "^9.17.0",
"has-ansi": "^2.0.0",
"home-or-tmp": "^2.0.0",
"is-finite": "^1.0.2",
"invariant": "^2.2.2",
"json5": "^0.5.1",
"js-tokens": "^3.0.1",
"jquery": "^3.2.1",
"jsesc": "^1.3.0",
"laravel-mix": "^0.4.0",
"lodash": "^4.17.4",
"loose-envify": "^1.3.1",
"mkdirp": "^0.5.1",
"minimatch": "^3.0.3",
"minimist": "^0.0.8",
"number-is-nan": "^1.0.1",
"os-homedir": "^1.0.2",
"os-tmpdir": "^1.0.2",
"path-is-absolute": "^1.0.1",
"private": "^0.1.7",
"regenerator-runtime": "^0.10.3",
"repeating": "^2.0.1",
"slash": "^1.0.0",
"source-map": "^0.5.6",
"source-map-support": "^0.4.14",
"strip-ansi": "^3.0.1",
"trim-right": "^1.0.1",
"to-fast-properties": "^1.0.2",
"vue": "^2.3.0"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}
我正在一个流浪汉的盒子里运行我的项目,我正在运行laravel 5.4。
答案 0 :(得分:16)
首先检查是否安装了cross-env模块。如果没有,请运行:
node_modules
之后,您需要转到cross-env
文件夹。
然后找到cross-env.js
文件夹。进去找{4}。
就我而言,它是mode_modules/cross-env/dist/bin/cross-env.js
您需要在cross-env.js
文件的scripts
部分中更改package.json
的路径。
{
"private": true,
"scripts": {
"dev": "node_modules/cross-env/dist/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",
"watch": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
........
}
答案 1 :(得分:10)
执行命令
npm install
然后再试一次。
答案 2 :(得分:8)
有几种方法可以解决此错误。
删除node_modules文件夹,然后再次执行npm install
。
如果它没有解决那么:
您可以通过解雇
dev dependency
npm install --save-dev cross-env
如果它当时没有解决:
cross-env
npm install --g cross-env
它将安装在\ Users \ Roaming \ npm模块中。然后我建议你关闭你的外壳然后再打开它。解雇命令。 如果它没有解决的话: - 在Package.json中你可以使用:
node node_modules / dist / bin / cross-env cross-env ...
答案 3 :(得分:1)
如果上述解决方案无效,请使用
刷新node_modules
import java.util.Arrays;
import java.util.Scanner;
public class Matrix {
public static void main(String[] args) {
int[][] matrix = Matrix.matrixCreator();
for(int p = 0; p < matrix.length; p++) {
for(int o = 0; o < matrix[p].length; o++) {
System.out.println(Arrays.toString(matrix[p][o]));
}
}
}
public static int[][] matrixCreator() {
int[][] matrix = new int[3][3];
Scanner scan = new Scanner(System.in);
int[] convertToInt = new int[3];
for(int position = 1; position <= matrix.length; position++) {
System.out.printf("Enter the elements of the matrix in row %d separating them with spaces: " , position);
convertToInt[0] = scan.nextInt();
convertToInt[1] = scan.nextInt();
convertToInt[2] = scan.nextInt();
matrix[position - 1] = convertToInt;
}
return matrix;
}
}
这对我有用
答案 4 :(得分:0)
您需要检查是否已安装cross-env模块。如果没有,请运行:
npm install cross-env
但你需要将它识别为“命令”。根据接受的答案提出修补路径(或者是吗?)使我更进一步,但仍然给了我一个错误。
我的解决方案是重新加载流浪汉“vagrant reload --provision”,并重置我的ssh / putty会话。
答案 5 :(得分:0)
有时会删除/node_modules
并运行
npm install
将解决此类问题。
答案 6 :(得分:0)
如果您像我的情况那样急于解决此错误,只需从您的cross-env
中删除package.json
并运行没有它的laravel mix ..
答案 7 :(得分:0)
快速的解决方案是运行:npm clean-install,可以修复laravel混合错误。
答案 8 :(得分:0)
我不得不将存储库克隆到一个新文件夹中。 无法识别哪个本地文件/设置导致了错误。