javascript - 解决失败: { Error: Cannot find module 'npm-watch'

标签 javascript node.js express

当我运行“npm install”时,它成功运行并安装了node_module文件夹中的所有包。但是,当我在 cmd 中运行“npm start”命令时,它会出现以下错误。

D:\INSM-HTML-Player>npm start
insm-player@1.0.0 start D:\INSM-HTML-Player
npm run build && npm run serve | npm run watch
insm-player@1.0.0 build D:\INSM-HTML-Player
rollup -c && concat-cli -f dist/main.js -o dist/all.js && npm run compress
resolve failed:  { Error: Cannot find module 'npm-watch'
at Function.Module._resolveFilename (module.js:469:15)
at Function.requireRelative.resolve (D:\INSM-HTML-Player\node_modules\requir e-relative\index.js:30:17)
at resolve (D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\seriali ze.js:25:26)
at findAndRemove (D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\s erialize.js:67:11)
at D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\serialize.js:111:13 at Array.map (native)
at loadPreset (D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\serialize.js:103:29)
at module.exports (D:\INSM-HTML-Player\node_modules\modify-babel-preset\inde x.js:97:19)
at Object.<anonymous> (D:\INSM-HTML-Player\node_modules\babel-preset-es2015-rollup\index.js:3:18)
at Module._compile (module.js:570:32) code: 'MODULE_NOT_FOUND' } npm-watch resolve failed:  { Error: Cannot find module 'grunt-cli'
at Function.Module._resolveFilename (module.js:469:15)
at Function.requireRelative.resolve (D:\INSM-HTML-Player\node_modules\requir e-relative\index.js:30:17)
at resolve (D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\seriali ze.js:25: at findAndRemove (D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\s erialize.js:67:11)
at D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\serialize.js:111:13
at Array.map (native)
at loadPreset (D:\INSM-HTML-Player\node_modules\modify-babel-preset\lib\serialize.js:103:29)
at module.exports (D:\INSM-HTML-Player\node_modules\modify-babel-preset\index.js:97:19)
at Object.<anonymous> (D:\INSM-HTML-Player\node_modules\babel-preset-es2015-rollup\index.js:3:18)
at Module._compile (module.js:570:32) code: 'MODULE_NOT_FOUND' } gruntcli C:\Program Files\nodejs\node.exe D:\INSM-HTML-Player\node_modules\rollup\bin\rollup concat-cli -f string -o string

Options:   -f, --files   files or glob/wildcard to be matched and concatenated
                                                             [array] [required]

 -o, --output  the resulting file of the concatenation[string] [default: "all"]

--helpShow help [boolean]Examples:   concat-cli -f *.js -o bundle.js  This will concatenate all the js files in the current directory into a bundle.js    Missing required argument: f
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe""C:\\ProgramFiles\\nodejs\\node_modules\\npm\\bin\\npm cli.js" "run" "build" 
npm ERR! node v6.9.4
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! insm-player@1.0.0 build: `rollup -c && concat-cli -f dist/main.js o dist/all.js && npm run compress`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the insm-player@1.0.0 build script 'rollup -c && concat cli - f dist/main.js -o dist/all.js && npm run compress'.

npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the insm-player package,  
npm ERR! not with npm itself.  npm ERR! Tell

the author that this fails on your system:  
npm ERR!     rollup -c &&
concat-cli -f dist/main.js -o dist/all.js && npm run c ompress  npm
ERR! You can get information on how to open an issue for this project
with:  
npm ERR!     npm bugs insm-player  npm ERR! Or if that isn't

available, you can get their info via:  npm ERR!     npm owner ls
insm-player  
npm ERR! There is likely additional logging output
above.
npm ERR! Please include the following file with any support request:
npm ERR!     D:\INSM-HTML-Player\npm-debug.log
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program  Files\\nodejs\\  node_modules\\npm\\bin\\npm-cli.js" "start"  npm
ERR! node v6.9.4  npm ERR! npm  v3.10.10  npm ERR! code ELIFECYCLE 
npm ERR! insm-player@1.0.0 start: `npm run build && npm run serve |
npm run watch`  
npm ERR! Exit status 1  npm ERR!  npm ERR! Failed

at the insm-player@1.0.0 start script 'npm run build && npm run
serve | npm run watch'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the insm-player package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build && npm run serve | npm run watch
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs insm-player
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls insm-player
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\INSM-HTML-Player\npm-debug.log

最佳答案

您必须将缺少的包 npm-watch 添加到 package.json 中:

npm install npm-watch --save-dev

再次运行npm start

关于javascript - 解决失败: { Error: Cannot find module 'npm-watch' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41610819/

相关文章:

javascript - Jquery/Javascript - 在 contentEditable 区域中作为用户类型突出显示的语法

javascript - 如何让 Rollup 转换 require() 调用?

node.js - NodeJS 和 MongoDB : Is there a way to listen to a collection and have an callback be called when a collection has new document?

javascript - 精确匹配边界未知的 10 个数字?

node.js - Express.js 是否遵守 RFC-3986 的查询字符串?

javascript - rentlinx 特色属性(property)删除重复项

javascript - 从一个框架集中访问另一个框架集中的元素

html - 使用 Node 从客户端的按钮获取用户信息

jquery - csurf AJAX 调用 - 无效的 CSRF token

javascript - React Express 应用程序中的客户端 session 管理