Recently I face an issues to install my dependencies using latest Node and NPM on my MacBook Air M1 machine. Then I found out M1 is not supported latest Node version. So my solution, to using NVM and change them to Node v14.16
Everything works well, but when our team apply new eslint configuration. Yet, I still not sure whether eslint was causes the error or not.
.eslintrc
{
"env": {
"es6": true,
"browser": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"impliedStrict": true,
"jsx": true
}
},
"plugins": ["react", "prettier", "@babel"],
"rules": {
// "prettier/prettier": [
// "warn",
// {
// "endOfLine": "auto",
// }
// ],
"no-console": 1,
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"linebreak-style": 0,
"quotes": [2, "single"],
"semi": 0,
"curly": [2, "all"],
"camelcase": "off",
"react/display-name": "off",
"eqeqeq": [2, "smart"],
"one-var-declaration-per-line": [2, "always"],
"new-cap": 2,
"no-case-declarations": 0
},
"globals": {
"axios": true,
"PropTypes": true
},
"settings": {
"import/resolver": {
"alias": [["./src/"]]
}
}
}
This error was occurred:
Error
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! zlib: incorrect data check
Log
5147 silly saveTree └── [email protected]
5148 verbose stack ZlibError: zlib: incorrect data check
5148 verbose stack at Unzip.write (/Users/metalheadcoder/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/minizlib/index.js:147:22)
5148 verbose stack at Object.write (/Users/metalheadcoder/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:305:58)
5148 verbose stack at PassThrough.ondata (internal/streams/readable.js:719:22)
5148 verbose stack at PassThrough.emit (events.js:315:20)
5148 verbose stack at addChunk (internal/streams/readable.js:309:12)
5148 verbose stack at readableAddChunk (internal/streams/readable.js:284:9)
5148 verbose stack at PassThrough.Readable.push (internal/streams/readable.js:223:10)
5148 verbose stack at PassThrough.Transform.push (internal/streams/transform.js:166:32)
5148 verbose stack at PassThrough.afterTransform (internal/streams/transform.js:101:10)
5148 verbose stack at PassThrough._transform (internal/streams/passthrough.js:46:3)
5148 verbose stack at PassThrough.Transform._read (internal/streams/transform.js:205:10)
5148 verbose stack at PassThrough.Transform._write (internal/streams/transform.js:193:12)
5148 verbose stack at writeOrBuffer (internal/streams/writable.js:358:12)
5148 verbose stack at PassThrough.Writable.write (internal/streams/writable.js:303:10)
5148 verbose stack at Readable.ondata (internal/streams/readable.js:719:22)
5148 verbose stack at Readable.emit (events.js:315:20)
5149 verbose cwd /Users/metalheadcoder/Gitlab/warefe
5150 verbose Darwin 21.1.0
5151 verbose argv "/Users/metalheadcoder/.nvm/versions/node/v14.16.1/bin/node" "/Users/metalheadcoder/.nvm/versions/node/v14.16.1/bin/npm" "install"
5152 verbose node v14.16.1
5153 verbose npm v6.14.12
5154 error code Z_DATA_ERROR
5155 error errno -3
5156 error zlib: incorrect data check
5157 verbose exit [ -3, true ]
Machine
MacBookAir M1 2020
Approach
- Install package using
nvm use v14
- Install package using
nvm use v16
- Install package using
nvm use v17
- Remove node_modules and package-lock.js also run
npm cache clean --force
Thank you in advance.
14.17
didn't help. I installed dependencies using version 16 (nvm use 16
) then switched back to version 14 (nvm use 14
) – Priscillaprise