Reactjs windows 10错误->'';不被识别为内部或外部命令
我试图在React中编写的解析器的终端中运行“npm run build”。但是每当我这样做的时候,我就会得到一个内联错误Reactjs windows 10错误->'';不被识别为内部或外部命令,reactjs,webpack,Reactjs,Webpack,我试图在React中编写的解析器的终端中运行“npm run build”。但是每当我这样做的时候,我就会得到一个内联错误 > matrix@1.0.0 build E:\work\Parser\parser > ./node_modules/webpack-cli/bin/cli.js --mode=development '.' is not recognized as an internal or external command, operable program or b
> matrix@1.0.0 build E:\work\Parser\parser
> ./node_modules/webpack-cli/bin/cli.js --mode=development
'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! matrix@1.0.0 build: `./node_modules/webpack-cli/bin/cli.js --mode=development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the matrix@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\criti\AppData\Roaming\npm-cache\_logs\2019-12-18T08_21_16_082Z-debug.log
这只在windows中发生。
当我寻找
./node_modules/webpack-cli/bin/cli.js --mode=development
在package.json中,我发现它被写成
"build": "./node_modules/webpack-cli/bin/cli.js --mode=development",
"build:dev": "./node_modules/webpack-cli/bin/cli.js --mode=developement",
"build:prod": "./node_modules/webpack-cli/bin/cli.js --mode=production",
"build:watch": "./node_modules/webpack-cli/bin/cli.js --watch",
"build-server": "./node_modules/webpack-cli/bin/cli.js ./parser.js -o ./parser_server.bundle.js --target='node'",
这是什么问题 您不需要在每个命令上放置
/node\u modules/webpack cli/bin/
,只需放置webpack--mode development
假设您安装了npx,请在命令行中尝试以下操作:npx webpack--mode=development
,但此代码不是我可以更改的,因为它是我公司的git项目。但是当我这样做时,我得到一个错误,``--mode'不被识别为内部或外部命令,``好吧,我想他们是在Linux上做的,因为在Windows上我们使用\而不是/,这就是为什么它不起作用的原因。是的,其他开发人员主要使用它。有没有办法修复它呢?我想它实际上是webpack--modedevelopment
。在linux上,这个文件是通过shebang中指定的解释器运行的。请参阅:注意:这是一个解决方法。。。i、 e.解释器硬编码到扩展…旁注:在“build:dev”
中有一个输入错误,您有--mode=developement
节点的哪个版本?