package.json文件中的脚本无法通过“ npm run”命令运行,但失败,并显示消息“ Singh \ Template \ node_modules.bin \不被识别为内部或外部命令,” 附带的图像显示完整的错误消息。
Package.json
(<(?:a|p|img)[^>]*>)|<[^>]+>
运行实时服务器时出错
{
"name": "singh-and-singh-template",
"version": "1.0.0",
"description": "Demo Template for Singh and Singh Pharmacy",
"main": "app.js",
"scripts": {
"compile:sass": "node-sass scss/main.scss css/style.css -w",
"live": "live-server"
},
"author": "Bodhisatwa Barma",
"license": "ISC",
"devDependencies": {
"live-server": "^1.2.1",
"node-sass": "^4.14.1"
}
}
运行节点无效
npm run live
> singh-and-singh-template@1.0.0 live D:\Projects\Singh & Singh\Template
> live-server
'Singh\Template\node_modules\.bin\' is not recognized as an internal
or external command,
operable program or batch file.
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module 'D:\Projects\live-server\live-server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
at Function.Module._load (internal/modules/cjs/loader.js:842:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! singh-and-singh-template@1.0.0 live: `live-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the singh-and-singh-template@1.0.0 live script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\CC\AppData\Roaming\npm-cache\_logs\2020-06-12T08_12_38_144Z-debug.log