webpacker icon indicating copy to clipboard operation
webpacker copied to clipboard

Importing styles from node_modules is showing no file or directory error

Open johnisaac opened this issue 9 years ago • 5 comments

Hi,

I tried to follow the instructions from the wiki to import styles from node_modules. But I keep getting the following error message.

Module build failed: Error: ENOENT: no such file or directory, open '/Users/johnisaac/code/webpacker_sample/app/javascript/styles/~boostrap/dist/bootstrap.css'

Above line is in a hello_react.sass file with the following content @import '~boostrap/dist/bootstrap.css'

hello_react.sass file is imported in another hello_react.js file like import '../styles/hello_react'

Any help is appreciated.

johnisaac avatar Jun 09 '17 14:06 johnisaac

@johnisaac Please don't use extension it's already added in the extensions list.

@import '~boostrap/dist/bootstrap

gauravtiwari avatar Jun 09 '17 14:06 gauravtiwari

@gauravtiwari When I tried without the extension, it is showing a similar error

File to import not found or unreadable: ~boostrap/dist/bootstrap.

johnisaac avatar Jun 09 '17 14:06 johnisaac

There is a typo - ~bootstrap/dist/bootstrap

gauravtiwari avatar Jun 09 '17 14:06 gauravtiwari

I did not include . at the end in the source code but it is showing up in the log.

screen shot 2017-06-09 at 7 49 07 am screen shot 2017-06-09 at 7 50 37 am

johnisaac avatar Jun 09 '17 14:06 johnisaac

Ah, I see you what you mean. Thanks!

johnisaac avatar Jun 09 '17 14:06 johnisaac