Skip to content

bug: 'npm install' postInstall fails in Windows because no sh (or sed) #894

@rjstone

Description

@rjstone

Steps To Reproduce

I cloned the repo in windows and followed the instructions, but it fails at the point where 'sh' is expected to exist.
Fails at this point in npm install:

R:\gitrepos\icestudio > npm install --legacy-peer-deps

> [email protected] postinstall
> sh scripts/postInstall.sh && grunt getcollection && npmpd && cd app && npm install

'sh' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path R:\gitrepos\icestudio
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c sh scripts/postInstall.sh && grunt getcollection && npmpd && cd app && npm install

It looks like scripts/postInstall.sh only does this:

$SED_CMD 's/options\.srcDir/\/\/options.srcDir/g' node_modules/grunt-nw-builder/tasks/nw.js

to comment out that one line in node_modules/grunt-nw-builder/tasks/nw.js, so I just did that manually (though I'm unsure of the purpose) and edited package.json to remove the shell script so that postinstall is now:

"postinstall": "grunt getcollection && npmpd && cd app && npm install"

and everything will install and run after that.

Suggestion: Use a node.js postinstall script to do this instead of a sh script.

Expected behavior

R:\gitrepos\icestudio > npm install --legacy-peer-deps

> [email protected] postinstall
> grunt getcollection && npmpd && cd app && npm install

Executing Gruntfile.js...
Running "clean:collection" (clean) task
>> 1 path cleaned.

Running "wget:collection" (wget) task
Downloaded 1 file

Running "unzip:using-router" (unzip) task
Created "app/resources" directory

Running "clean:collectionFile" (clean) task
>> 1 path cleaned.

Done.
No specific dependencies on this platform: win32

up to date, audited 191 packages in 2s

20 packages are looking for funding
  run `npm fund` for details

21 vulnerabilities (1 low, 3 moderate, 13 high, 4 critical)

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

> [email protected] prepare
> npm run setupDevEnv


> [email protected] setupDevEnv
> grunt setupDevEnv

Executing Gruntfile.js...
Running "setupDevEnv" task
✅ Hook pre-commit installed

Done.

up to date, audited 487 packages in 14s

48 packages are looking for funding
  run `npm fund` for details

23 vulnerabilities (5 moderate, 18 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

Actual behavior

Fails at this point in npm install:

R:\gitrepos\icestudio > npm install --legacy-peer-deps

> [email protected] postinstall
> sh scripts/postInstall.sh && grunt getcollection && npmpd && cd app && npm install

'sh' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path R:\gitrepos\icestudio
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c sh scripts/postInstall.sh && grunt getcollection && npmpd && cd app && npm install

Screenshots or video

No response

Desktop (please complete the following information)

OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.26100 N/A Build 26100
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free

I'm using the nw.js that was installed from the spec in package.json which is:

nw.js v0.95.0
Node v23.3.0
Chromium 132.0.6834.84
commit hash: 079dc40-a79a1f7-def931e-31f9a3a

Web console trace

n/a

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions