jkk / shinkgs

A JavaScript client for the KGS Go Server
https://shin.gokgs.com/
MIT License
266 stars 55 forks source link

Can't start development build (due to chartist/dist/scss/chartist) #206

Open dnp87 opened 5 years ago

dnp87 commented 5 years ago

Greetings. I am getting the output following. Changing import in question to "@import " node_modules/ chartist/dist/scss/chartist" fixes an error, but I'm not sure it should be necessary. Am I doing something wrong?

yarn start
yarn run v1.15.2
$ yarn run build-sass && yarn run start-sass & HTTPS=true react-scripts start
$ node-sass --include-path='node_modules' src/css/index.scss src/index.css
{
  "status": 1,
  "file": "D:/wip/shinkgs/src/css/_charts.scss",
  "line": 21,
  "column": 1,
  "message": "File to import not found or unreadable: chartist/dist/scss/chartist.",
  "formatted": "Error: File to import not found or unreadable: chartist/dist/scss/chartist.\n        on line 21 of src/css/_charts.scss\n        from line 15 of src/css/index.scss\n>> @import \"chartist/dist/scss/chartist\";\n   ^\n"
}
error Command failed with exit code 1.
ahiijny commented 4 years ago

I got this too. It seems to be a Windows thing.

It looks like the yarn/npm run script uses the OS default shell to interpret the script commands in package.json, even if you invoke yarn run in a different shell such as git bash. On Windows, that would be cmd, so there are a few bash-isms that wouldn't work properly on Windows.

For example, the build-sass script runs node-sass --include-path='node_modules' src/css/index.scss src/index.css. On Windows, I think what's happening is that cmd interprets the single quotes as literal quotes. So node-sass tries to look in the path 'node_modules' (with single quotes) which doesn't exist, and that's why it's not finding the chartist scss files.

This also means the HTTPS=true in the start script wouldn't work (in Windows cmd, the equivalent would be something like set HTTPS=true), and the & for background process wouldn't work either.

tl;dr For the time being, my hacky workaround is to remove the single quotes from the start-sass and build-sass scripts in package.json, and to change the start script to yarn run build-sass && start /B yarn run start-sass && set HTTPS=true&& react-scripts start.