docker-node icon indicating copy to clipboard operation
docker-node copied to clipboard

error /app/node_modules/node-sass: Command failed.

Open Marusyk opened this issue 7 years ago • 12 comments

We are using node:lts-alpine as image for build stage.

Everything worked fine before Nov 05, when we run rebuild (without code changes). On step RUN yarn

yarn install v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@vue/cli-plugin-babel > [email protected]" has unmet peer dependency "webpack@>=2".
warning "@vue/cli-plugin-eslint > [email protected]" has unmet peer dependency "webpack@>=2.0.0 <5.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error /app/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /app/node_modules/node-sass
Output:
Building: /usr/local/bin/node /app/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/app/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21) {
gyp verb `which` failed   stack: 'Error: not found: python2\n' +
gyp verb `which` failed     '    at getNotFoundError (/app/node_modules/which/which.js:13:12)\n' +
gyp verb `which` failed     '    at F (/app/node_modules/which/which.js:68:19)\n' +
gyp verb `which` failed     '    at E (/app/node_modules/which/which.js:80:29)\n' +
gyp verb `which` failed     '    at /app/node_modules/which/which.js:89:16\n' +
gyp verb `which` failed     '    at /app/node_modules/isexe/index.js:42:5\n' +
gyp verb `which` failed     '    at /app/node_modules/isexe/mode.js:8:5\n' +
gyp verb `which` failed     '    at FSReqCallback.oncomplete (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:158:21) {
gyp verb `which` failed   stack: 'Error: not found: python\n' +
gyp verb `which` failed     '    at getNotFoundError (/app/node_modules/which/which.js:13:12)\n' +
gyp verb `which` failed     '    at F (/app/node_modules/which/which.js:68:19)\n' +
gyp verb `which` failed     '    at E (/app/node_modules/which/which.js:80:29)\n' +
gyp verb `which` failed     '    at /app/node_modules/which/which.js:89:16\n' +
gyp verb `which` failed     '    at /app/node_modules/isexe/index.js:42:5\n' +
gyp verb `which` failed     '    at /app/node_modules/isexe/mode.js:8:5\n' +
gyp verb `which` failed     '    at FSReqCallback.oncomplete (fs.js:158:21)',
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/app/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/app/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/app/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/app/node_modules/which/which.js:80:29)
gyp ERR! stack     at /app/node_modules/which/which.js:89:16
gyp ERR! stack     at /app/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /app/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:158:21)
gyp ERR! System Linux 4.4.0-140-generic
gyp ERR! command "/usr/local/bin/node" "/app/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /app/node_modules/node-sass
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
The command '/bin/sh -c yarn' returned a non-zero code: 1

⚠️ ⚠️ all builds are broken! ⚠️ ⚠️

were there any breaking changes? if yes then why it was do for tag lts-alpine but not for the new one? Can anybody help? Please

Marusyk avatar Nov 07 '19 17:11 Marusyk

There are instructions for buiding native modules on alpine https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#node-gyp-alpine There are a few other issues about node-sass if you search the repo

nschonni avatar Nov 08 '19 01:11 nschonni

But it was working. What happen? I didn't upgrade any versions

Marusyk avatar Nov 08 '19 08:11 Marusyk

Had a similar problem with /node_modules/node-sass: Command failed on building my application, which also occurred within the last week without any updates on my end.

Had a look at the node-sass docs and the node version on the server and it was using node v12.13.0 and the version of node-sass was 4.9.x.

in the node-sass release docs it lists that for node v12 you need to have node-sass v4.12 and up.

Updating node-sass version corrected the build for me, hope it helps for you too.

node Release docs: https://github.com/sass/node-sass/releases

GionDesigns avatar Nov 12 '19 02:11 GionDesigns

Thanks @GionDesigns, it helped. I've upgraded node-sass from 4.9.0 to 4.12.0 and it is building now

Marusyk avatar Nov 12 '19 17:11 Marusyk

My team ran into a similar issue this morning. Our dockerfile used alpine linux version 3.9 as a base (and ran apk to install nodejs). Updating our base to use alpine 3.11 seems to resolve this for us as well.

daveshah avatar Jan 16 '20 17:01 daveshah

Had a similar problem with /node_modules/node-sass: Command failed on building my application, which also occurred within the last week without any updates on my end.

Had a look at the node-sass docs and the node version on the server and it was using node v12.13.0 and the version of node-sass was 4.9.x.

in the node-sass release docs it lists that for node v12 you need to have node-sass v4.12 and up.

Updating node-sass version corrected the build for me, hope it helps for you too.

node Release docs: https://github.com/sass/node-sass/releases

Ty, a lot!

andrerferrer avatar Jan 23 '20 13:01 andrerferrer

I'm novice here with npm and node-sass however, in my project I'm running into this issue. How do you install the binding.node?

Arconapalus avatar Jan 25 '20 23:01 Arconapalus

@Arconapalus - are you running your project in a docker container? If so, change the docker container you are using. For example, if you were using node:9-alpine (which uses node version 9.x), you could update to using the node:12-alpine docker image (which uses Node version 12.x).

If you are not running your project in docker, then checkout nvm which lets you install and manage multiple versions of node on your development machine.

zlove avatar Feb 07 '20 20:02 zlove

Hi I m am using the node:latest image when the docker try reach RUN node -v it give me error node not found I also try to run a command through CMD It gives me the error modules not found I try to run CMD "node" "dist/main.js" the dist folder is there is the directory but it still give me the error.

Kindly guide me through this issue.

vggarg96 avatar Jul 01 '20 20:07 vggarg96

I had the same issue. The solution was to use Node below version 15.0.1.

janigowski avatar Oct 29 '20 12:10 janigowski

how

nainyshah avatar Nov 09 '20 12:11 nainyshah

The easiest way is by n - node version manger: https://github.com/tj/n

janigowski avatar Nov 09 '20 18:11 janigowski