简体   繁体   中英

npm install - determine the end of the installation

Using a python automated tool, I run the command npm install followed by npm run build in my project to build a .war file and put it in a tomcat server.

I need to run npm install every time because I wipe the folder and make a new git clone using Jenkins, every time .

The problem is that the python script tries to find a sentence that I determine in advance that will confirm that it can start the next task, but when I run the command npm install there is no clean way I can determine that the task is done because that's the end of the output:

|   `-- is-buffer@1.1.5
+-- webpack-war-plugin@1.0.0-beta.3
| +-- archiver@1.3.0
| | +-- archiver-utils@1.3.0
| | | +-- glob@7.1.2
| | | `-- lazystream@1.0.0
| | +-- async@2.4.1
| | +-- buffer-crc32@0.2.13
| | +-- glob@7.1.2
| | +-- tar-stream@1.5.4
| | | +-- bl@1.2.1
| | | `-- end-of-stream@1.4.0
| | +-- walkdir@0.0.11
| | `-- zip-stream@1.1.1
| |   `-- compress-commons@1.2.0
| |     `-- crc32-stream@2.0.0
| |       `-- crc@3.4.4
| `-- typescript@2.3.4
+-- whatwg-fetch@1.1.1
`-- write@0.3.3
`-- fs-exists-sync@0.1.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\browser-sync\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

But the output is not always going to be the same. All I am looking for is a way to properly know that the command is done like: npm installation completed . Unless there is a better way to do it. (It has to work on windows and linux)

要打印npm install done ,在年底npm install的输出到一个日志文件:

npm install >> D:\npmInstall.log 2>&1 && echo npm install done >> D:\npmInstall.log 2>&1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM