Windows 10错误->'。'不被识别为内部或外部命令

时间:2019-12-18 08:26:17

标签: javascript reactjs windows node-canvas

我正在用React编写的解析器终端中尝试tu run'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 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'",

这是什么问题?

2 个答案:

答案 0 :(得分:0)

您无需在每个命令上放置./node_modules/webpack-cli/bin/,只需将webpack --mode development放在

答案 1 :(得分:0)

假设您已安装npx,请在命令行中尝试以下操作:npx webpack --mode=development