[英]'.' 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.