node-sass
node-sass copied to clipboard
../node_modules/nan/nan.h, line 904 Assertion failed: (size <= imp::kMaxLength && "too large buffer")
- NPM version (
npm -v
):6.13.4
- Node version (
node -v
):v13.6.0
- Node Process (
node -p process.versions
):
{
node: '13.6.0',
v8: '7.9.317.25-node.26',
uv: '1.34.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '79',
nghttp2: '1.40.0',
napi: '5',
llhttp: '2.0.1',
openssl: '1.1.1d',
cldr: '35.1',
icu: '64.2',
tz: '2019a',
unicode: '12.1'
}
- Node Platform (
node -p process.platform
):darwin
- Node architecture (
node -p process.arch
):x64
- node-sass version (
node -p "require('node-sass').info"
):
node-sass 4.13.1 (Wrapper) [JavaScript]
libsass 3.5.4 (Sass Compiler) [C/C++]
- npm node-sass versions (
npm ls node-sass
):
[email protected] /Users/alaa/Test/my-ibm-security-react-app
└── [email protected]
Description:
I'm not sure where to log this issue (I've logged it before for reference: https://github.com/nodejs/nan/issues/883).
Trying to compile a simple SASS project (that uses this: https://github.com/carbon-design-system/ibm-security) fails (after maybe 10 minutes) with this error:
Assertion failed: (size <= imp::kMaxLength && "too large buffer"), function CopyBuffer, file ../node_modules/nan/nan.h, line 904.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alaa/.npm/_logs/2020-01-23T16_28_20_322Z-debug.log
Contents of /Users/alaa/.npm/_logs/2020-01-23T16_28_20_322Z-debug.log
are:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/Cellar/node/13.6.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'run',
1 verbose cli 'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/alaa/Test/my-ibm-security-react-app/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS
9 verbose lifecycle [email protected]~start: CWD: /Users/alaa/Test/my-ibm-security-react-app
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:321:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:321:20)
13 verbose stack at maybeClose (internal/child_process.js:1028:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/alaa/Test/my-ibm-security-react-app
16 verbose Darwin 19.2.0
17 verbose argv "/usr/local/Cellar/node/13.6.0/bin/node" "/usr/local/bin/npm" "run" "start"
18 verbose node v13.6.0
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-scripts start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I can consistently reproduce this on my machine by doing the following:
# create a standard react app
npx create-react-app my-ibm-security-react-app
cd my-ibm-security-react-app
# add node-sass and @carbon/ibm-security
yarn add node-sass @carbon/ibm-security @carbon/type
# create a .env file to add your node_modules to the SASS loader
# as described here: https://create-react-app.dev/docs/adding-a-sass-stylesheet/
# without this, imports won't work.
echo "SASS_PATH=node_modules" > .env
# rename the .css files to .scss
mv src/index.css src/index.scss
mv src/App.css src/App.scss
# edit the .js files to import .scss instead of .css
sed -i '' 's/index.css/index.scss/' src/index.js
sed -i '' 's/App.css/App.scss/' src/App.js
# add the @carbon/ibm-security scss styles to index.scss
echo '@import "@carbon/ibm-security/scss/index";' >> src/index.scss
# then start
npm run start
If I don't import the SCSS components of the ibm-security package @carbon/ibm-security/scss/index
and instead just import their CSS components like this: @carbon/ibm-security/css/index.min.css
the compile works fine, so I'm assuming that this is related to some buffer/memory size related to how the scss is being compiled?
How large are the sass files question?
node_modules/@carbon/ibm-security/
is 21 MB, but it has a few dependencies in the same @carbon
directory, @carbon
is 57 MB. Here's the breakdown of all other carbon
related dependencies:
$ du -h -d1 node_modules | grep carbon
10M node_modules/carbon-components
42M node_modules/carbon-components-react
57M node_modules/@carbon
1.5M node_modules/carbon-icons
Those are the sizes of the whole folders (which include .js
files). But if you just wanted to know how big the total size of just .scss
files in all of the above folders, then it's 5.6 MB:
$ find node_modules/*carbon* -name "*.scss" | xargs du -h -c | tail -1
5.6M total