You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 the node executable wrappers (for all three shells) and run npm install node again.
cd .\node_modules\node and 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 on core-js and therefore causes the core-jspostinstall script to run. That postinstall script calls node -e ... which npm automatically redirects to call the local copy of node instead of the system copy.
Observe that the postinstall script runs without error.
Manually delete node_modules and run npm install
Observe that the postinstall script again runs with no error.
Run npm ci - this automatically deletes node_modules before it runs and then runs npm install making sure to use the exact package versions specified in package-lock.json.
Observe that the postinstall script of core-js now exits with an error The 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.
The text was updated successfully, but these errors were encountered:
The thing I am still trying to figure out is why there is a difference between npm intall and npm ci. I would think that they should both work the same way.
In order to make sure I am using the same dependencies, I usually run
npm ci
instead ofnpm 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:
.\node_modules\node\
directory and thenode
executable wrappers (for all three shells) and runnpm install node
again.cd .\node_modules\node
and 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 whennpm 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-js
and therefore causes thecore-js
postinstall
script to run. Thatpostinstall
script callsnode -e ...
which npm automatically redirects to call the local copy of node instead of the system copy.postinstall
script runs without error.node_modules
and runnpm install
postinstall
script again runs with no error.npm ci
- this automatically deletesnode_modules
before it runs and then runsnpm install
making sure to use the exact package versions specified inpackage-lock.json
.postinstall
script ofcore-js
now exits with an errorThe system cannot find the path specified.
.\node_modules\.bin\node.cmd
.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.
The text was updated successfully, but these errors were encountered: