I have a node/npm/react project. I have a script "local": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js"
and run npm run local
and I get the following error:
我有一个node / npm / react项目。我有一个脚本“local”:“。/ node_modules / webpack-dev-server / bin / webpack-dev-server.js”并运行npm run local,我收到以下错误:
Uncaught Error: Cannot find module "/Users/me/Dropbox/myStuff/aProject/site/node_modules/webpack-dev-server/client/index.js?http://localhost:8080"
未捕获错误:找不到模块“/Users/me/Dropbox/myStuff/aProject/site/node_modules/webpack-dev-server/client/index.js?http://localhost:8080”
index.js looks like:
index.js看起来像:
import { render } from "react-dom";
import React from "react";
import App from "./App";
render(<App />, document.getElementById("root"));
I have installed all of these npm
modules. Why cannot a module be found?
我已经安装了所有这些npm模块。为什么找不到模块?
Oddly, I notice that even if I comment out index.js
entirely, I get the same error message.
奇怪的是,我注意到即使我完全注释掉index.js,我也会收到相同的错误消息。
1 个解决方案
#1
0
npm install --save-dev webpack is not enough.
npm install --save-dev webpack是不够的。
You have to install also the following: npm install --save-dev webpack-dev-server
您还必须安装以下内容:npm install --save-dev webpack-dev-server
And optionally, you can install also : npm install --save-dev webpack-dev-middleware webpack-hot-middleware
也可以选择安装:npm install --save-dev webpack-dev-middleware webpack-hot-middleware
And you should look your webpack file to set the good path
你应该看看你的webpack文件来设置好的路径
Can you post your WP file ?
你可以发布你的WP文件吗?
#1
0
npm install --save-dev webpack is not enough.
npm install --save-dev webpack是不够的。
You have to install also the following: npm install --save-dev webpack-dev-server
您还必须安装以下内容:npm install --save-dev webpack-dev-server
And optionally, you can install also : npm install --save-dev webpack-dev-middleware webpack-hot-middleware
也可以选择安装:npm install --save-dev webpack-dev-middleware webpack-hot-middleware
And you should look your webpack file to set the good path
你应该看看你的webpack文件来设置好的路径
Can you post your WP file ?
你可以发布你的WP文件吗?