The repo has been successfully migrated to 9.4.0 the day before. Today, updated @nrwl/* to 9.4.2, successfully as well.
But, when running yarn install, an error is reported by NX, any nx commands still work fine.
Note that the shell being used is Windows PowerShell.
NX ERROR Unable to create a symlink from the Angular CLI to the Nx CLI:ENOENT: no such file or directory, open './node_modules/.bin/nx.ps1'
NX ERROR Decoration of the Angular CLI did not complete successfully
here is the content of node_modules/.bin:
env:PS>dir .\node_modules.bin\nx*
-a---- 6/16/2020 3:06 PM 309 nx
-a---- 6/16/2020 3:06 PM 186 nx.cmd
Versions etc...
env:PS>yarn nx --version
yarn run v1.21.1
$ nx --version
9.4.2env:PS>yarn ng --version
yarn run v1.21.1
$ nx --version
9.4.2env:PS>yarn --version
1.21.1
No error.
Please delete node_modules and run yarn install again...
UPDATE: I confirm that the problem also exists with a fresh workspace. NO nx.ps1 under node_modules/.bin and same errors reported by NX.
NX Report complete - copy this into the issue template
@nrwl/angular : 9.4.2
@nrwl/cli : 9.4.2
@nrwl/cypress : 9.4.2
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 9.4.2
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.4.2
@nrwl/web : Not Found
@nrwl/workspace : 9.4.2
typescript : 3.8.3
For what it's worth, I got it to work removing the .ps1 string from this section of the decorate angular cli script
if (isWindows) {
/**
* This is the most reliable way to create symlink-like behavior on Windows.
* Such that it works in all shells and works with npx.
*/
["", ".cmd"].forEach((ext) => {
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
});
} else {
I'm not sure if that is indeed the fix but at least it let me keep working in the meantime
Thanks @abdes and @ramarivera. We'll need to add a check for the existence of each file before attempting to symlink it.
Hi @brandonroberts, is someone already working on this? If not, I'd be happy to PR it.
@ramarivera not that I know of. You're welcome to take it
['', '.cmd', '.ps1'].forEach((ext) => {
if (fs.existsSync(nxPath + ext))
fs.writeFileSync(ngPath + ext, fs.readFileSync(nxPath + ext));
});
Most helpful comment