-
Notifications
You must be signed in to change notification settings - Fork 53
Description
In order to make sure I am using the same dependencies, I usually run npm ci instead of npm install when I am working on my development machine (running Windows 10), unless I am specifically updating dependencies.
It seems that running npm ci does not install the node binaries, leading to errors.
It does create .\node_modules\.bin\node, .\node_modules\.bin\node.cmd, and .\node_modules\.bin\node.ps1 executable wrappers (for Bash, Command Prompt, and Powershell respectively), but those files point to the executable located at .\node_modules\node\bin\node, which is not present.
The two workarounds for this that I have found are:
- Manually delete the
.\node_modules\node\directory and thenodeexecutable wrappers (for all three shells) and runnpm install nodeagain. cd .\node_modules\nodeand run (PowerShell shown here)& 'C:\Program Files\nodejs\node.exe' .\installArchSpecificPackage.js
I'm not sure why the preinstall script doesn't seem to work when npm ci is used, but I do think it needs to be fixed.
Background:
Here is how I first found this problem:
npm install vuejs-datatable- this depends oncore-jsand therefore causes thecore-jspostinstallscript to run. Thatpostinstallscript callsnode -e ...which npm automatically redirects to call the local copy of node instead of the system copy.- Observe that the
postinstallscript runs without error.
- Observe that the
- Manually delete
node_modulesand runnpm install- Observe that the
postinstallscript again runs with no error.
- Observe that the
- Run
npm ci- this automatically deletesnode_modulesbefore it runs and then runsnpm installmaking sure to use the exact package versions specified inpackage-lock.json.- Observe that the
postinstallscript ofcore-jsnow exits with an errorThe system cannot find the path specified. - Observe that this is true for any call to
.\node_modules\.bin\node.cmd. - The error returned from the PowerShell version is more useful:
The term 'C:\path\to\my\app\node_modules\.bin/../node/bin/node' is not recognized as the name of a cmdlet, function, script file, or operable program.
- Observe that the