dreid
dreid

Reputation: 183

npx postcss : Could not determine executable to run

I use docker with apache and I am getting the next error when trying to use the npm , npm build-prod.

Basically it executes this function npx postcss tailwind-source.css -o tailwind-output.css and this is were the error showes, I will share log.

0 verbose cli /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/var/www/html/src/app/design/frontend/Vendor/default_hyva/web/tailwind/.npmrc Completed in 0ms
10 timing config:load:project Completed in 8ms
11 timing config:load:file:/root/.npmrc Completed in 0ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 20ms
19 timing npm:load:configload Completed in 20ms
20 timing npm:load:mkdirpcache Completed in 2ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm exec postcss tailwind-source.css -o tailwind-output.css
23 verbose argv "exec" "--" "postcss" "tailwind-source.css" "-o" "tailwind-output.css"
24 timing npm:load:setTitle Completed in 2ms
25 timing config:load:flatten Completed in 4ms
26 timing npm:load:display Completed in 6ms
27 verbose logfile logs-max:10 dir:/root/.npm/_logs
28 verbose logfile /root/.npm/_logs/2022-08-09T14_46_32_693Z-debug-0.log
29 timing npm:load:logFile Completed in 5ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 36ms
33 silly logfile start cleaning logs, removing 1 files
34 silly logfile done cleaning log files
35 timing arborist:ctor Completed in 1ms
36 timing arborist:ctor Completed in 0ms
37 http fetch GET 200 https://registry.npmjs.org/postcss 267ms (cache revalidated)
38 timing command:exec Completed in 534ms
39 verbose stack Error: could not determine executable to run
39 verbose stack     at getBinFromManifest (/usr/lib/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js:17:23)
39 verbose stack     at exec (/usr/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:155:15)
39 verbose stack     at async module.exports (/usr/lib/node_modules/npm/lib/cli.js:78:5)
40 verbose pkgid [email protected]
41 verbose cwd /var/www/html/src/app/design/frontend/Vendor/default_hyva/web/tailwind
42 verbose Linux 5.10.16.3-microsoft-standard-WSL2
43 verbose node v18.7.0
44 verbose npm  v8.16.0
45 error could not determine executable to run
46 verbose exit 1
47 timing npm Completed in 658ms
48 verbose code 1
49 error A complete log of this run can be found in:
49 error     /root/.npm/_logs/2022-08-09T14_46_32_693Z-debug-0.log

Currently I have installed from scratch like so :

apt-get update
apt-get install curl 
curl -sL https://deb.nodesource.com/setup_18.x | bash 
# Install nodejs
apt-get install nodejs 
# check if installed
node -v 
# npm installs automatically 
npm -v
#Install updated version of npm
npm install -g [email protected]

Then I go to where my package.json folder is and execute

npm install

In my package.json I have some dependencies aswell :

    "dependencies": {
        "@hyva-themes/hyva-modules": "^1.0.1",
        "@tailwindcss/forms": "^0.2.1",
        "@tailwindcss/typography": "^0.3.1",
        "autoprefixer": "^10.2.1",
        "browser-sync": "^2.26.14",
        "csso-cli": "^3.0.0",
        "lodash": "^4.17.20",
        "postcss-import": "^12.0.1",
        "postcss-nested": "^4.2.3",
        "tailwindcss": "^2.2.9",
        "terser": "^4.7.0"
    },
    "devDependencies": {
        "postcss": "^8.3.6",
        "postcss-cli": "^8.3.1"
    }

Upvotes: 0

Views: 8894

Answers (2)

Arash Hasanzade
Arash Hasanzade

Reputation: 490

You must install postcss-cli too

npm i postcss-cli

Upvotes: 0

dreid
dreid

Reputation: 183

I figured out the solution and I don't know why.

I use docker to mount projects, and inside the docker-compose.yml I had declared 2 environment variables:

THIS_NODE_MODE:production TAILWIND_COMPILATION_MODE: jit

I removed them and now it works.

In my package.json the variables are created on execution of script :

"scripts": {
        "build": "npx postcss tail-source.css -o tail-output.css",
        ...,
        ...,
        "build-prod": "THIS_NODE_MODE=production TAILWIND_COMPILATION_MODE=jit npm run build",
        ...,
        ...,
    },

That solved it for me

Upvotes: 0

Related Questions