Closed derkjn closed 7 years ago
Same problem here.
@derkjn @gartz -- Can one of you give me a reproduction? If your projects aren't open source, then maybe a quick public repo with the minimum amount of code to cause the issue? I think it may be in the webpack aliases...
Also, as a totally unrelated side note, for code like:
"TweenLite": path.resolve('node_modules', 'gsap/src/uncompressed/TweenLite.js'),
I usually prefer the pattern of:
"TweenLite": require.resolve("gsap/src/uncompressed/TweenLite"),
In this way, you immediately get rid of any potential node_modules
tree structure flattening issues (not a problem for top-level dependencies) and you're basically just letting Node do what it does with resolving (giving extensions searching and other things that path.resolve
doesn't)
@tptee @kenwheeler -- What's the internal command that starts this part of webpack-dashboard
or can you point me to the integrating code involved here?
It's a programming problem if Error: Unable to find project root package.json
is happening because the option isn't passed within webpack-dashboard
...
@ryan-roemer Thank you for the quick response! I'll setup an example repo in the weekend and post the link to it here!
Well, I can't post my project here because it's a private one. But I don't have any kind of configuration like path.resolve
or require.resolve
.
To open webpack-dashboard
, I'm not passing any params/args.
The difference is that I run it inside a docker container and I'm using webpack@3.5.5
with node@8.4.0
.
I have patched webpack-dashboard
to allow change the host
so I can access the webpack-dashboard
outside of the container. The PR is https://github.com/FormidableLabs/webpack-dashboard/pull/188 it's tested and working, however, I'm seeing that message about the package.json
that I think it's unrelated to it.
In the weekend I can try to create another project open-source and reproduce the problem but I'm not sure if I will have the time because I'm traveling at the moment.
Hope this information help to find this bug (at least the webpack version and node version might be related to it, idk for sure).
Thanks for helping us.
I had this issue and got around it by unsetting context
in my webpack configuration. That means the entry points etc need to be adjusted accordingly, of course.
Hi @ryan-roemer , my apologies for the delay!
I finally got some time to clone the repo where I'm getting the error. You can find it here:
https://github.com/derkjn/webpack-dashboard-error
I have to say that this morning the newest version of webpack-dashboard
doesn't seem to be available via npm anymore, so I couldn't replicate the error anymore. Either way, once you clone the repo, navigate to the web/app/themes/ignitetheme
and from there run npm i && npm run watch
. That's what used to cause the error. You'll get php errors cause it a WP project but you can disregard those! Thank you!
Edit:
This is actually happening if you pull down webpack-dashboard@next
Seems like the problem is that, as pointed out by @tremby, package.json
file is being resolved searching in the context
folder specified in the webpack configuration.
@ugo-buonadonna that make sense to me because my context is a sub-folder. It should transverse up until finding the first package.json
@derkjn -- I've pulled down https://github.com/derkjn/webpack-dashboard-error and am trying to repro your issue with:
$ npm i
$ npm run watch
But the error I get is File to import not found or unreadable: ~bootstrap/scss/normalize
.
Is there an additional install step I need to do?
It's pulling down the wrong version of bootstrap. Can you use yarn? otherwise I'll change the package.json to a strict version of that package. Let me know! Thank you!
@derkjn -- Hmmm... running:
$ rm -rf node_modules
$ yarn install
$ yarn run watch
successfully compiles and I get no errors whatsoever.
Side note:
$ pwd
/PATH/TO/derkjn-webpack-dashboard-error/web/app/themes/ignitetheme
Are you running yarn
from that directory? If so, do I need additional steps to see your error?
Here's what I see right now...
@ryan-roemer if you run yarn add -D webpack-dashboard@next
and re-run yarn watch
you'll get the error! thank you!
Repro'ed and confirmed it's a webpack-dashboard
bug and not an inspectpack
one. I'll keep this bug open and I'm working on a PR for webpack-dashboard
. As suspected, problem is use of context
outside of where the project root package.json
and node_modules
are.
Whenever I try to start
webpack-dashboard
the following error occurs:The project I'm working on is a WordPress project. Webpack is started from the theme folder which lives in
/web/app/themes/theme/package.json
.My webpack.config.js is as follows:
For your reference, the project is based on sage which reflects the structure of the theme folder in my project.