【发布时间】:2017-04-15 20:32:13
【问题描述】:
我是 node 和 npm 的新手。我一直在尝试编译我在 GitHub (https://github.com/marshallmurphy/Web-Apps/tree/master/Medication%20Reminder%20React%20App) 上找到的这个药物提醒应用程序,但 npm 不断产生错误。我试过“npm start”并运行“webpack”但没有运气。如何在终端编译和运行这个文件?
运行 npm start 时出现以下错误:
Dantes-MBP:Medication Reminder React App dantegreyson$ npm start
> medication-reminder-app@1.0.0 start /Users/dantegreyson/Desktop/Medication Reminder React App
> webpack-dev-server
sh: webpack-dev-server: command not found
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.9.1
npm ERR! npm v4.0.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! medication-reminder-app@1.0.0 start: `webpack-dev-server`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the medication-reminder-app@1.0.0 start script 'webpack-dev-server'.
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 medication-reminder-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs medication-reminder-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls medication-reminder-app
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /Users/dantegreyson/Desktop/Medication Reminder React App/npm-debug.log
我尝试按照建议全局安装 webpack,但现在出现以下错误:
Dantes-MBP:Medication Reminder React App dantegreyson$ npm start
> medication-reminder-app@1.0.0 start /Users/dantegreyson/Desktop/Medication Reminder React App
> webpack-dev-server
module.js:471
throw err;
^
Error: Cannot find module 'html-webpack-plugin'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/dantegreyson/Desktop/Medication Reminder React App/webpack.config.js:1:87)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.9.1
npm ERR! npm v4.0.2
npm ERR! code ELIFECYCLE
npm ERR! medication-reminder-app@1.0.0 start: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the medication-reminder-app@1.0.0 start script 'webpack-dev-server'.
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 medication-reminder-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack-dev-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs medication-reminder-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls medication-reminder-app
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Please include the following file with any support request:
npm ERR! /Users/dantegreyson/Desktop/Medication Reminder React App/npm-debug.log
【问题讨论】:
-
npm install&&npm start。如果它没有帮助。请发布相关错误 -
@TheReason 我安装了最新版本的 npm 和 node。但是我仍然收到错误消息。我已经发布了上面的错误。
-
我刚刚克隆了存储库并做了
npm install,安装完成后我做了npm start它就像魅力一样。节点版本4.4.3。npm install安装必要的软件包。我之前没有安装 webpack 或相关包。 -
@SatishPatel 在定向到 localhost:8080 之后,Web 应用程序是否在第一页之后工作(药物提醒:开始使用)?
-
在
npm start之后导航到localhost:8080它呈现药物提醒开始。
标签: node.js reactjs npm webpack package.json