简体   繁体   English

'。' 不被识别为内部或外部命令,可操作程序或批处理文件

[英]'.' is not recognized as an internal or external command, operable program or batch file

Source of problem (I think): 问题来源(我认为):

 "scripts": {
        "dev-server": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config config/webpack.config.js"
      },

Error log: 错误日志:

> somename@1.0.0 dev-server C:\Users\Admin\Downloads\somename
> ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config config/we
bpack.config.js

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! somename@1.0.0 dev-server: `./node_modules/webpack-dev-server/bin/webpa
ck-dev-server.js --config config/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the somename@1.0.0 dev-server script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2018-01-29T13_52_01_
170Z-debug.log

I am receiving this error and because of that I'm not able to: npm run dev-server . 我收到此错误,因此,我无法执行以下操作: npm run dev-server

Is there a way to replace ./ part? 有没有办法替换./ part?

Just refer to the binary directly: 只需直接引用二进制文件即可:

    "scripts": {
        "dev-server": "webpack-dev-server --config config/webpack.config.js"
     },

npm will run the script in an environment where all the installed packages' binaries (namely node_modules/.bin/ ) are directly available in PATH, including webpack-dev-server . npm将在所有安装的软件包的二进制文件(即node_modules/.bin/ )在PATH中直接可用的环境中运行脚本,包括webpack-dev-server

Also using / as a path separator is preferable in package.json - it works on Windows as well as Linux or OSX. 最好在package.json使用/作为路径分隔符-它可以在Windows以及Linux或OSX上运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 'lightercollective' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'lightercollective' is not recognized as an internal or external command, operable program or batch file 无法将“ nodemon”识别为内部或外部命令,可操作程序或批处理文件 - 'nodemon' is not recognized as an internal or external command, operable program or batch file 无法将“节点”识别为内部或外部命令,可操作程序或批处理文件 - 'node' is not recognized as an internal or external command, operable program or batch file 'cocos'不被识别为内部或外部命令,可操作程序或批处理文件 - 'cocos' is not recognized as an internal or external command, operable program or batch file '' 不被识别为内部或外部命令,可操作程序或批处理文件 - '.' is not recognized as an internal or external command, operable program or batch file 'express' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'express' is not recognized as an internal or external command, operable program or batch file 'GOOS' 不是内部或外部命令,也不是可运行的程序 或批处理文件 - 'GOOS' is not recognized as an internal or external command, operable program or batch file 'CI' 不是内部或外部命令,也不是可运行的程序 或批处理文件 - 'CI' is not recognized as an internal or external command, operable program or batch file 'firebase' 不是内部或外部命令,也不是可运行的程序或批处理文件 - 'firebase' is not recognized as an internal or external command, operable program or batch file 在 Windows 上运行forever.js 时出错-“'C:\\Program' 不是内部或外部命令、可运行的程序或批处理文件” - Error running forever.js on Windows - "'C:\Program' is not recognized as an internal or external command, operable program or batch file"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM