Skip to content

Error running "yarn run toolbox" #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rtpm opened this issue Dec 19, 2016 · 22 comments
Closed

Error running "yarn run toolbox" #1

rtpm opened this issue Dec 19, 2016 · 22 comments

Comments

@rtpm
Copy link

rtpm commented Dec 19, 2016

Not sure if this is react-toolbox-themr related, but I'm getting error while running "yarn run toolbox"

{ Error: ENOENT: no such file or directory, open 'C:\C:\Users\b\dev\custom-cra\node_modules\react-toolbox\lib\helpers.css'
at Error (native)
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\C:\Users\b\dev\custom-cra\node_modules\react-toolbox\lib\helpers.css' }
{ Error: ENOENT: no such file or directory, open 'C:\C:\Users\b\dev\custom-cra\node_modules\react-toolbox\lib\helpers.css'

[email protected]
[email protected]

It generates pubic/react-toolbox/theme.js and theme.css, but I'm getting error when running "yarn start"

Error in ./public/react-toolbox/theme.css
Module not found: ../helpers.css in C:\Users\b\dev\custom-cra\public\react-toolbox

@ .//css-loader?modules&importLoaders=1&localIdentName=[name][local]_[hash:base64:5]!.//postcss-loader!./public/react-toolbox/theme.css 3:10-196

Thanks

@javivelasco
Copy link
Member

Are you sure the version is 2.0.0-beta.4? helpers.css was added in that release. Please browse your node_modules/react-toolbox to make it sure!

@rtpm
Copy link
Author

rtpm commented Dec 19, 2016

Yes, I'm using 2.0.0-beta.4
I can see helpers.css in the 'react-toolbox/lib' directory.

The problem is the path, where windows drive name is doubled 'C:\C:\Users...'

@javivelasco
Copy link
Member

javivelasco commented Dec 19, 2016

Damn, I don't have a Windows OS to try it out. Mabye cross-env?

@javivelasco
Copy link
Member

I can't test it, sorry. Sure it's related to resolve.path, may you try out and check the source?

@Rajiv-Kulkarni
Copy link

Rajiv-Kulkarni commented Dec 19, 2016

Same here.
Also, after I add this line to index.js:
import './toolbox/theme.css';
I get this error:

image

I am trying to recreate the datepicker exmaple from react-slingshot. I made sure react-toolbox is working fine from the project. Thanks.

The folder structure looks like this:
image

@Rajiv-Kulkarni
Copy link

Rajiv-Kulkarni commented Dec 19, 2016

Also, how do I add the ThemeProvider with the existing router Provider? The index.js looks like this:
import React from 'react';
import {render} from 'react-dom';
import { Provider } from 'react-redux';
import { Router, browserHistory } from 'react-router';
import routes from './routes';
import configureStore from './store/configureStore';
require('./favicon.ico'); // Tell webpack to load favicon.ico
import './styles/styles.scss'; // Yep, that's right. You can import SASS/CSS files too! Webpack will run the associated loader and plug this into the page.
import { syncHistoryWithStore } from 'react-router-redux';
import theme from './toolbox/theme';
import ThemeProvider from 'react-toolbox/lib/ThemeProvider';
//import './toolbox/theme.css';

const store = configureStore();

// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store);

render(
Provider store={store}>
Router history={history} routes={routes} />
/Provider>, document.getElementById('app')
);

I am omitting the html angle brackets just for display purpose.

@rtpm
Copy link
Author

rtpm commented Dec 19, 2016

Checked the 1.0.1 version

Running "yarn toolbox" returns

> react-toolbox-themr

{ Error: ENOENT: no such file or directory, open 'C:\C:\Users\b\dev\custom-cra\node_modules\react-toolbox\lib\helpers.css'
    at Error (native)
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\C:\\Users\\b\\dev\\custom-cra\\node_modules\\react-toolbox\\lib\\helpers.css' }
{ Error: ENOENT: no such file or directory, open 'C:\C:\Users\b\dev\custom-cra\node_modules\react-toolbox\lib\helpers.css'
    at Error (native)
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\C:\\Users\\b\\dev\\custom-cra\\node_modules\\react-toolbox\\lib\\helpers.css' }
{ Error: ENOENT: no such file or directory, open 'C:\C:\Users\b\dev\custom-cra\node_modules\react-toolbox\lib\helpers.css

c:/users/b/dev/custom-cra/src/App.js with imports:

import ThemeProvider from 'react-toolbox/lib/ThemeProvider';
import theme from './toolbox/theme.js';
import './toolbox/theme.css';

Running npm start (yarn start)

Failed to compile.

Error in ./src/toolbox/theme.css
Module not found: ../helpers.css in C:\Users\b\dev\custom-cra\src\toolbox

 @ ./~/css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!./~/postcss-loader!./src/toolbox/theme.css 3:10-196

@javivelasco
Copy link
Member

Apparently there is a problem in the way paths are resolved in the package that breaks in Windows. Again, I don't own a Windows machine so I can't try out what I dig. Need help for this :)

@Rajiv-Kulkarni It looks like you are processing the imported CSS with sass-loader. You only need the css-loader because the output CSS is already transformed and ready to be used. Apart from that, you should wrap the RouteProvider with ThemeProvider. It should work.

@Rajiv-Kulkarni
Copy link

Rajiv-Kulkarni commented Dec 19, 2016

I am using react-slingshot and it has sass-loader installed already. I am not a webpack savvy, so if someone could let me know how to avoid using sass-loader and use css-loader with css files, would be great. Portion of the webpack looks like this:
module: {
loaders: [
{test: /.jsx?$/, exclude: /node_modules/, loaders: ['babel']},
{test: /.eot(?v=\d+.\d+.\d+)?$/, loader: 'file'},
{test: /.woff(2)?(?v=[0-9].[0-9].[0-9])?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},
{test: /.[ot]tf(?v=\d+.\d+.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream'},
{test: /.svg(?v=\d+.\d+.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml'},
{test: /.(jpe?g|png|gif)$/i, loader: 'file?name=[name].[ext]'},
{test: /.ico$/, loader: 'file?name=[name].[ext]'},
{test: /(.css|.scss)$/, loaders: ['style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name][local]_[hash:base64:5]!postcss!sass', 'postcss', 'sass?sourceMap']},
{test: /.json$/, loader: "json"}
]
},

Thanks and appreciate.

@Rajiv-Kulkarni
Copy link

Rajiv-Kulkarni commented Dec 19, 2016

I think I got past the css issue. I added i to the index.ejs (pic below). I am getting this error:
image

The code looks like this:
index.js:
image

HomePage.js
image

index.ejs:
image

Am I doing anything wrong? I get the error when I add the TimePicker markup to the HomePage.js. Thanks.

@Rajiv-Kulkarni
Copy link

I get this:
image

With this code:
image

How do I get the time picker to display on button click?

@javivelasco
Copy link
Member

The import for the TimePicker is import TimePicker from react-toolbox/lib/TimePicker.
Maybe that's the issue

@Rajiv-Kulkarni
Copy link

Rajiv-Kulkarni commented Dec 20, 2016

I fixed that and getting the results above. Not on button click though. Not sure how you get to display the time picker on button click.

@Rajiv-Kulkarni
Copy link

Rajiv-Kulkarni commented Dec 20, 2016

Javi, if I post my project here on github, would you be able to take a look at it and let me know what I am doing wrong? I think I added everything according to the instructions (except for the output property in the package.json which I did not understand). I am running Windows 7 by the way. Thanks.

@Rajiv-Kulkarni
Copy link

I guess I am stupid. Beginning to understand what this is about. No need to say "Please ignore me", since I see you folks already have. :)
Hopefully will have some intelligent questions next time. Before I do, one more stupid question. If I am able to integrate react-toolbox in my application, I don't need to use the react-toolbox-themr really, is that correct? Thanks.

@javivelasco
Copy link
Member

Sorry @Rajiv-Kulkarni, I was keeping myself away from the laptop during Christmas. You can run react-toolbox without this package. The purpose of this is to skip the setup you must add to configure css-modules which is a requirement for react-toolbox.

Internally, we are just requiring CSS so your module bundler needs to support it enable CSS Modules resolution. Without this setup, you can't really use RT in an easy way. This packages allows to skip the whole setup. Take into account that you in RT you can require files in two different ways: requiring css (import from index.js for each component) or requiring the component itself. For this to work you need to use the latter.

I hope you get it working. I'm keeping the issue open because it is actually a bug running in Windows. If you have more doubts try to reach using Discord of in Stackoverflow. I'll be happy to help but I may need some time :)

@mattzuba
Copy link

@javivelasco I'm trying to use this utility on Windows and ran into the same issue. I attempted some troubleshooting but wasn't very successful. I don't think the path issue is in your code, I'm inclined to think it might be an issue with postcss, but I'm not sure where. Trying to debug/troubleshoot transpiled code is a pain in the ass, haha. Maybe that helps in trying to track it down, or maybe you're familiar enough with postcss to give me some pointers on where to look in their codebase for how it resolves items like composes: reset from '../helpers.css';

@javivelasco
Copy link
Member

javivelasco commented Jan 20, 2017

@mattzuba I'm going to release a new version without the css modules import. It was just removed because it was troublesome. Can you try it out when it's published?

@mattzuba
Copy link

Sure will, can't wait! I've been banging my head against a wall trying to figure out how postcss or one of it's plugins handles :include() statements!

@javivelasco
Copy link
Member

I know 😁 It's a well known bug with pathnames in css modules! That's why I removed it in react-toolbox. I need to write a Changelog for the release so I'll try to publish tomorrow, thanks!

@mattzuba
Copy link

hey @javivelasco - this issue seems to be fixed with beta.5 of react-toolbox now, thanks! Now there's just issue #11 that is cropping up.

@javivelasco
Copy link
Member

Great! That's fixed too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants