dudulaopo833 / Tools-Learning

各种杂七杂八-错误处理等
0 stars 0 forks source link

postinstall failed in Yarn but success in NPM #13

Closed dudulaopo833 closed 7 years ago

dudulaopo833 commented 7 years ago

If package.json have postinstall script( npm install xxx && dw-dev info), it can see the command dw-dev in npm bin, but cannot see it in yarn bin(as install the package failed in the last step). If remove postinstall, then can see dw-dev in yarn bin! Yarn version : 0.24.5 and 0.27.5

Error as below:

[4/4] Building fresh packages...
[2/2] ⠁ group-digital-wealth-starterkit
[-/2] ⠁ waiting...
[-/2] ⠁ waiting...
[-/2] ⠂ waiting...
error C:\Users\xxx\AppData\Local\Yarn\config\global\node_modules\group-digital-wealth-starterkit: Command failed.
Exit code: 1
Command: C:\WINDOWS\system32\cmd.exe
Arguments: /d /s /c dw-dev info
Directory: C:\Users\xxx\AppData\Local\Yarn\config\global\node_modules\group-digital-wealth-starterkit
Output:
'dw-dev' is not recognized as an internal or external command,
operable program or batch file.
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

And if the package version is not update, while you use yarn add to install, it will install the cache one. So need to clear the cache one use "yarn cache clean" command