Not all NPM scripts are executed during deployment
See original GitHub issueAccording to the NPM docs prepublish
script should be executed on local npm install without any arguments. It seems that on Now it is not the case.
I depend on this to compile my sources (e.g. coffee
, elm
-> js
).
Consider this sample package to test scripts execution. This is the output on my local machine:
$ npm install
> npm-scripts@1.0.0 preinstall /Users/tadeuszlazurski/Projects/npm-scripts
> echo 'NPM SCRIPT: preinstall'
NPM SCRIPT: preinstall
|
> npm-scripts@1.0.0 install /Users/tadeuszlazurski/Projects/npm-scripts
> echo 'NPM SCRIPT: install'
NPM SCRIPT: install
> npm-scripts@1.0.0 postinstall /Users/tadeuszlazurski/Projects/npm-scripts
> echo 'NPM SCRIPT: postinstall'
NPM SCRIPT: postinstall
> npm-scripts@1.0.0 prepublish /Users/tadeuszlazurski/Projects/npm-scripts
> echo 'NPM SCRIPT: prepublish'
NPM SCRIPT: prepublish
coffee-script@1.10.0 node_modules/coffee-script
lodash@3.10.1 node_modules/lodash
and this is output from now
:
$ now
> Deploying ~/Projects/npm-scripts
> Using Node.js 6.2.1 (default)
> Ready! https://npm-scripts-izbtgitqee.now.sh (copied to clipboard) [3s]
> Upload [====================] 100% 0.0s
> Sync complete (25.9kB) [3s]
> Initializing…
> Building
> ▲ npm install
> Installing package lodash@^3.10.1
> Installing package coffee-script@^1.9.3
> ▲ npm start
> NPM SCRIPT: prestart
> NPM SCRIPT: start
> NPM SCRIPT: poststart
> start exited with status 0
As you can see none of the following scripts:
preinstall
install
postinstall
prepublish
was executed in Now.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:7 (1 by maintainers)
Top Results From Across the Web
scripts - npm Docs
These all can be executed by running npm run-script <stage> or npm run ... Does not run during npm publish , but does...
Read more >npm script does not run through npm run <script-name> but ...
I am trying to deploy an application on an aws linux machine. I wrote scripts to be run on Linux (for when I...
Read more >Job can run successful without executing all script commands ...
The Windows version does not always execute all commands of the job's script. The script execution can somehow get interrupted by a command....
Read more >npm Scripts: Tips Everyone Should Know - Corgibytes
Every script in npm runs three separate scripts under the hood. A pre script, a script itself and a post script. Those two...
Read more >Testing and deploying with ordered npm run scripts
Run scripts before deploying ... Using the command npm run deploy in your terminal will start the publishing process. ... Prepending pre or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I unfortunately ran into this problem today. None of the
preinstall
andpostinstall
scripts I had in my package were being successfully run using Now during deployment.The workaround is to deploy a Docker image that contains your Node app.