aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.
MIT License
407 stars 133 forks source link

Windows/Linux ENOENT for fsevents #1170

Closed ahaleiii closed 4 years ago

ahaleiii commented 4 years ago

aurelia-cli@v1.3.0 npm@6.14.4

After installing globally (npm i -g aurelia-cli), when I list the global packages with npm list -g --depth 0 I get an error:

npm ERR! error in C:\Users\myuser\AppData\Roaming\npm\node_modules\aurelia-cli\node_modules\fsevents: ENOENT: no such file or directory, open 'C:\Users\myuser\AppData\Roaming\npm\node_modules\aurelia-cli\node_modules\fsevents\package.json'

I'm not sure if anything else is impacted; I am able to successfully execute au --version:

> au version
Global aurelia-cli v1.3.0

This is happening on my local (Windows 10) machine, as well as my build servers (Windows Server 2016 Datacenter & Ubuntu 18.04), which is breaking our pipeline scripting.

Steps to reproduce:

  1. Install aurelia-cli globally: npm i -g aurelia-cli
  2. List global packages: npm list -g --depth 0

Abridged output:


PS C:\Users\myuser> npm list -g --depth 0
C:\Users\myuser\AppData\Roaming\npm
[other packages]
+-- aurelia-cli@1.3.0
[other packages]

npm ERR! error in C:\Users\myuser\AppData\Roaming\npm\node_modules\aurelia-cli\node_modules\fsevents: ENOENT: no such file or directory, open 'C:\Users\myuser\AppData\Roaming\npm\node_modules\aurelia-cli\node_modules\fsevents\package.json'
PS C:\Users\myuser>
ahaleiii commented 4 years ago

If I manually remove the bad folder, then the issue goes away:

PS C:\Users\myuser> rm -r C:\Users\myuser\AppData\Roaming\npm\node_modules\aurelia-cli\node_modules\fsevents
PS C:\Users\myuser> npm list -g --depth 0
C:\Users\myuser\AppData\Roaming\npm
[other packages]
+-- aurelia-cli@1.3.0
[other packages]

PS C:\Users\myuser> au --version
Global aurelia-cli v1.3.0
PS C:\Users\myuser>

(Works on Linux too.)

This does not seem like the best solution because it is a manual step and breaks automation scenarios.

3cp commented 4 years ago

https://www.npmjs.com/package/fsevents is the file watcher in macOS only. Chokidar uses fsevents in macOS. gulp-watch uses chokidar.

It's probably a npm (or chokidar/gulp-watch) issue. We got quite few circleci e2e tests on this repo, but didn't encounter your error on Linux box.

Do you explicitly run npm list -g --depth 0 in your ci pipeline?

ahaleiii commented 4 years ago

We only run this in a few of our pipelines, mostly for logging purposes. I have created a simple pipeline to highlight the failure and executed it on an Ubuntu agent (we use Azure DevOps):

image

Note that I uninstalled/reinstalled aurelia-cli globally prior to executing this. When I manually delete the directory listed in the error, the pipeline executes successfully.

3cp commented 4 years ago

First, this is likely a dep issue originated in our deps, not a directly issue from aurelia-cli. Second, you don't need global installed aurelia-cli, just use locally installed aurelia-cli in your project.

If you want to use au <command>, after npm install, just use npx au <command> (npx will use the local aurelia-cli). If you look into package.json scripts section, you can find we supported many npm scripts. You can just run npm start, npm test, npm run build without touching au. Adjust those scripts if you wish.

ahaleiii commented 4 years ago

Thanks for the feedback. While I think the scenario which this issue occurs is still present, our use cases have shifted after we focused more on our project-level dependencies. I am not looking to pursue this further. Appreciate your help @3cp .