Npm 找不到模块';实时服务器&x27;(本地安装)
我一直尝试在本地运行babel和live server,但是在调用“npm运行构建”或“npm运行服务”时,我遇到以下错误:Npm 找不到模块';实时服务器&x27;(本地安装),npm,Npm,我一直尝试在本地运行babel和live server,但是在调用“npm运行构建”或“npm运行服务”时,我遇到以下错误: > boilerplate@1.0.0 serve C:\Users\sasaa\OneDrive\Documents\HTMl&CSS\j-14-05-globals\boilerplate > live-server public 'CSS\j-14-05-globals\boilerplate\node_modules\.bin\' is no
> boilerplate@1.0.0 serve C:\Users\sasaa\OneDrive\Documents\HTMl&CSS\j-14-05-globals\boilerplate
> live-server public
'CSS\j-14-05-globals\boilerplate\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 'C:\Users\sasaa\OneDrive\Documents\live-server\live-server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
at Function.Module._load (internal/modules/cjs/loader.js:859: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! boilerplate@1.0.0 serve: `live-server public`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the boilerplate@1.0.0 serve 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\sasaa\AppData\Roaming\npm-cache\_logs\2020-01-05T00_21_18_216Z-debug.log
这是json包:
{
"name": "boilerplate",
"version": "1.0.0",
"description": "",
"main": "input.js",
"scripts": {
"serve": "live-server public",
"build": "babel src/index.js --out-file public/scripts/bundle.js --presets env --watch"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"live-server": "^1.2.1"
}
}
我正在使用Windows10和GitBash
npm版本6.13.4
节点v13.5.0
有什么建议可以解决这个问题吗?您是否尝试删除
node\u模块
并再次运行npm安装
?是的,我仍然收到相同的错误。我也试着重新安装node和npm,但仍然出现同样的错误。我想它可能和path变量有关,但还没有成功地使它工作。还有其他建议吗@纳奥列维