Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

au new --here fails to scaffold project #1188

Closed
davidsk opened this issue Nov 15, 2020 · 19 comments
Closed

au new --here fails to scaffold project #1188

davidsk opened this issue Nov 15, 2020 · 19 comments
Assignees

Comments

@davidsk
Copy link

davidsk commented Nov 15, 2020

I'm submitting a bug report

  • Library Version:
    2.0.2

Please tell us about your environment:

  • Operating System:
    Windows 10

  • Node Version:
    15.0.1

  • NPM Version:
    7.0.3

  • Browser:
    n/a

  • Language:
    n/a

  • Loader/bundler:
    n/a

Current behavior:
calling au new ( or npx makes aurelia/v1) returns an error:

Global aurelia-cli v2.0.2
makes v2.0.1 https://makes.js.org
Cannot find git repo aurelia\v1
npm ERR! code 1
npm ERR! path C:\Dev\Scratch\aurelia-routing-with-backend
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ""makes" "aurelia\v1" "--here""
  • What is the expected behavior?
    Command completes without error
@3cp
Copy link
Member

3cp commented Nov 15, 2020

It looks like win32 rewrote aurelia/v1 to aurelia\v1 because it thinks it's a local path.

spawn('npx', ['makes', 'aurelia/v1', ...args], {stdio: 'inherit', shell: true});

It's probably the behaviour of spawn in child_process. I will run some tests.

@3cp
Copy link
Member

3cp commented Nov 15, 2020

In the meanwhile, you can directly do npx makes aurelia/v1 --here.

@3cp 3cp self-assigned this Nov 15, 2020
@davidsk
Copy link
Author

davidsk commented Nov 16, 2020

I'm afraid that doesn't work either, the forward-slash is swapped for out for a backslash

npx makes aurelia/v1 --here 
makes v2.0.1 https://makes.js.org
Cannot find git repo aurelia\v1
npm ERR! code 1
npm ERR! path C:\Dev\Scratch\aurelia-routing-with-backend
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ""makes" "aurelia\v1" "--here""       

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\keith\AppData\Local\npm-cache\_logs\2020-11-16T14_05_36_054Z-debug.log

full log:

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'exec',
0 verbose cli   '--',
0 verbose cli   'makes',
0 verbose cli   'aurelia/v1',
0 verbose cli   '--here'
0 verbose cli ]
1 info using npm@7.0.3
2 info using node@v15.0.1
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:C:\Dev\Scratch\aurelia-routing-with-backend\.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\keith\.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\keith\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 7ms
19 verbose npm-session 30de3e2a7e0851f6
20 timing npm:load Completed in 15ms
21 http fetch GET 200 https://registry.npmjs.org/makes 12ms (from cache)
22 timing arborist:ctor Completed in 1ms
23 timing arborist:ctor Completed in 0ms
24 timing arborist:ctor Completed in 1ms
25 timing arborist:ctor Completed in 0ms
26 timing command:exec Completed in 513ms
27 verbose stack Error: command failed
27 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:63:27)
27 verbose stack     at ChildProcess.emit (node:events:327:20)
27 verbose stack     at maybeClose (node:internal/child_process:1048:16)
27 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
28 verbose cwd C:\Dev\Scratch\aurelia-routing-with-backend
29 verbose Windows_NT 10.0.19042
30 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "exec" "--" "makes" "aurelia/v1" "--here"
31 verbose node v15.0.1
32 verbose npm  v7.0.3
33 error code 1
34 error path C:\Dev\Scratch\aurelia-routing-with-backend
35 error command failed
36 error command C:\Windows\system32\cmd.exe /d /s /c ""makes" "aurelia\v1" "--here""
37 verbose exit 1

You can see it recognises the forward-slash up until and including line 30 but line 36 shows it's flipped it.

Tried this with Powershell, VSCode Terminal (also Powershell but why not?) and cmd.exe, all the same

Pretty sure I tried this before logging the issue but I wanted to confirm.

@3cp
Copy link
Member

3cp commented Nov 17, 2020

Thanks very much for the investigation! I have not got a windows machine to try yet.

30 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "exec" "--" "makes" "aurelia/v1" "--here"
31 verbose node v15.0.1
32 verbose npm  v7.0.3
33 error code 1
34 error path C:\Dev\Scratch\aurelia-routing-with-backend
35 error command failed
36 error command C:\Windows\system32\cmd.exe /d /s /c ""makes" "aurelia\v1" "--here""

Probably node/npm/npx rewrote the arguments?
I can try to bypass this issue in "makes" implementation. Will let you know when it's ready.

@3cp
Copy link
Member

3cp commented Nov 17, 2020

Pls try au new again.

@davidsk
Copy link
Author

davidsk commented Nov 18, 2020

au new worked after I installed the upgraded makes package. Thanks.

@3cp
Copy link
Member

3cp commented Nov 18, 2020

You don't need to install makes. Npx makes (which au new simply wraps) works with zero installation. This is a feature of npx, it fetches from latest npm package if you didn't install it.

@3cp
Copy link
Member

3cp commented Nov 18, 2020

With zero install, npx makes always uses latest makes version. It doesn't keep makes in your npm global installed packages.

@davidsk
Copy link
Author

davidsk commented Nov 18, 2020

TL;DR;
I'm up and running and your assistance is very much appreciated.

I must have been doing something wrong then as simply running au new didn't do the job. I still have the console output:

C:\Dev\Scratch\aurelia-routing-with-backend> au new --here                           
Global aurelia-cli v2.0.2
makes v2.0.1 https://makes.js.org
Cannot find git repo aurelia\v1
npm ERR! code 1
npm ERR! path C:\Dev\Scratch\aurelia-routing-with-backend
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ""makes" "aurelia\v1" "--here""

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\keith\AppData\Local\npm-cache\_logs\2020-11-17T15_42_58_352Z-debug.log
C:\Dev\Scratch\aurelia-routing-with-backend> npm update aurelia-cli

up to date, audited 597 packages in 2s

37 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
C:\Dev\Scratch\aurelia-routing-with-backend> npx makes aurelia/v1 --here
makes v2.0.1 https://makes.js.org
Cannot find git repo aurelia\v1
npm ERR! code 1
npm ERR! path C:\Dev\Scratch\aurelia-routing-with-backend
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ""makes" "aurelia\v1" "--here""

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\keith\AppData\Local\npm-cache\_logs\2020-11-17T15_48_32_460Z-debug.log
C:\Dev\Scratch\aurelia-routing-with-backend> npm

Usage: npm <command>

npm install        install all the dependencies in your project
npm install <foo>  add the <foo> dependency to your project
npm test           run this project's tests
npm run <foo>      run the script named <foo>
npm <command> -h   quick help on <command>
npm -l             display usage info for all commands
npm help <term>    search for help on <term>
npm help npm       more involved overview

All commands:

    access, adduser, audit, bin, bugs, cache, ci, completion,
    config, dedupe, deprecate, dist-tag, docs, doctor, edit,
    exec, explain, explore, find-dupes, fund, get, help, hook,
    init, install, install-ci-test, install-test, link, ll,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rebuild, repo, restart, root,
    run-script, search, set, shrinkwrap, star, stars, start,
    stop, team, test, token, uninstall, unpublish, update,
    version, view, whoami

Specify configs in the ini-formatted file:
    C:\Users\keith\.npmrc
or on the command line via: npm <command> --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

npm@7.0.3 C:\Program Files\nodejs\node_modules\npm

C:\Dev\Scratch\aurelia-routing-with-backend> npm search
npm ERR! search must be called with arguments

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\keith\AppData\Local\npm-cache\_logs\2020-11-17T15_51_23_555Z-debug.log
C:\Dev\Scratch\aurelia-routing-with-backend> npm search makes
NAME                      | DESCRIPTION          | AUTHOR          | DATE       | VERSION  | KEYWORDS
makes                     | A tool to scaffold…  | =huochunpeng    | 2020-11-17 | 2.1.1    | scaffold app boilerplate
jsonexport                | Makes easy to…       | =ackerapple…    | 2020-06-17 | 3.0.1    | export json to 2 csv converter output array object json-to-csv json2csv parse stream transform big files
dot-object                | dot-object makes it… | =rhalff         | 2020-09-10 | 2.1.4    | json filter transform dot notation dot
jpegtran-bin              | jpegtran (part of…   | =1000ch…        | 2020-06-30 | 5.0.2    | imagemin compress image img jpeg jpg minify optimize jpegtran
endent                    | ➡️ An ES6 string tag… | =zhouhancheng   | 2020-04-13 | 2.0.1    | dedent tag multi-line string
is-glob                   | Returns `true` if…   | =doowb…         | 2019-03-27 | 4.0.1    | bash braces check exec expression extglob glob globbing globstar is match matches pattern regex regular string 
idb                       | A small wrapper…     | =jaffathecake   | 2020-10-08 | 5.0.7    | 
can                       | MIT-licensed,…       | =phillipskevin… | 2020-11-06 | 6.6.1    | CanJS DoneJS
comlink                   | Comlink makes…       | =developit…     | 2020-04-28 | 4.3.0    |
pngquant-bin              | `pngquant` wrapper…  | =1000ch…        | 2020-06-01 | 6.0.0    | imagemin compress image img minify optimize png pngquant
gifsicle                  | gifsicle wrapper…    | =1000ch…        | 2020-05-30 | 5.1.0    | imagemin gif img image compress minify optimize gifsicle
mozjpeg                   | mozjpeg wrapper…     | =1000ch…        | 2020-05-29 | 7.0.0    | imagemin jpeg jpg img image compress minify mozjpeg optimize
optipng-bin               | OptiPNG wrapper…     | =1000ch…        | 2020-05-24 | 7.0.0    | imagemin compress image minify optimize png optipng
mjml                      | MJML: the only…      | =kmcb =mjmlio…  | 2020-09-30 | 4.7.1    | 
plop                      | Micro-generator…     | =amwmedia       | 2020-07-31 | 2.7.4    | generator scaffolding yeoman make build generate gen plop
koa-better-error-handler  | A better…            | =niftylettuce   | 2020-08-23 | 6.0.1    | 404 500 async await better boom context ctx custom error error-handler errors es7 flash handler handling koa mecoz                       | Flexible generator,… | =okunishinishi  | 2020-10-01 | 7.2.1    | development generator sourcecode automation template
eslint-plugin-chai-friend | This plugin makes…   | =ihor.diachenko | 2020-04-24 | 0.6.0    | eslint eslintplugin eslint-plugin chai lint
ly                        |                      |                 |            |          |
pngout-bin                | pngout wrapper that… | =1000ch…        | 2020-06-02 | 5.0.0    | imagemin compress image img minify optimize png pngout
@polymer/polymer          | The Polymer library… | =aomarks…       | 2020-04-30 | 3.4.1    |
C:\Dev\Scratch\aurelia-routing-with-backend> npm install makes -g

added 1 package, and audited 1 package in 889ms

found 0 vulnerabilities
C:\Dev\Scratch\aurelia-routing-with-backend> npm search makes    
NAME                      | DESCRIPTION          | AUTHOR          | DATE       | VERSION  | KEYWORDS
makes                     | A tool to scaffold…  | =huochunpeng    | 2020-11-17 | 2.1.1    | scaffold app boilerplate
jsonexport                | Makes easy to…       | =ackerapple…    | 2020-06-17 | 3.0.1    | export json to 2 csv converter output array object json-to-csv json2csv parse stream transform big files
dot-object                | dot-object makes it… | =rhalff         | 2020-09-10 | 2.1.4    | json filter transform dot notation dot
jpegtran-bin              | jpegtran (part of…   | =1000ch…        | 2020-06-30 | 5.0.2    | imagemin compress image img jpeg jpg minify optimize jpegtran
endent                    | ➡️ An ES6 string tag… | =zhouhancheng   | 2020-04-13 | 2.0.1    | dedent tag multi-line string
is-glob                   | Returns `true` if…   | =doowb…         | 2019-03-27 | 4.0.1    | bash braces check exec expression extglob glob globbing globstar is match matches pattern regex regular string 
idb                       | A small wrapper…     | =jaffathecake   | 2020-10-08 | 5.0.7    |
can                       | MIT-licensed,…       | =phillipskevin… | 2020-11-06 | 6.6.1    | CanJS DoneJS
comlink                   | Comlink makes…       | =developit…     | 2020-04-28 | 4.3.0    |
pngquant-bin              | `pngquant` wrapper…  | =1000ch…        | 2020-06-01 | 6.0.0    | imagemin compress image img minify optimize png pngquant
gifsicle                  | gifsicle wrapper…    | =1000ch…        | 2020-05-30 | 5.1.0    | imagemin gif img image compress minify optimize gifsicle
mozjpeg                   | mozjpeg wrapper…     | =1000ch…        | 2020-05-29 | 7.0.0    | imagemin jpeg jpg img image compress minify mozjpeg optimize
optipng-bin               | OptiPNG wrapper…     | =1000ch…        | 2020-05-24 | 7.0.0    | imagemin compress image minify optimize png optipng
mjml                      | MJML: the only…      | =kmcb =mjmlio…  | 2020-09-30 | 4.7.1    |
plop                      | Micro-generator…     | =amwmedia       | 2020-07-31 | 2.7.4    | generator scaffolding yeoman make build generate gen plop
koa-better-error-handler  | A better…            | =niftylettuce   | 2020-08-23 | 6.0.1    | 404 500 async await better boom context ctx custom error error-handler errors es7 flash handler handling koa mecoz                       | Flexible generator,… | =okunishinishi  | 2020-10-01 | 7.2.1    | development generator sourcecode automation template
eslint-plugin-chai-friend | This plugin makes…   | =ihor.diachenko | 2020-04-24 | 0.6.0    | eslint eslintplugin eslint-plugin chai lint
ly                        |                      |                 |            |          |
pngout-bin                | pngout wrapper that… | =1000ch…        | 2020-06-02 | 5.0.0    | imagemin compress image img minify optimize png pngout
@polymer/polymer          | The Polymer library… | =aomarks…       | 2020-04-30 | 3.4.1    |
C:\Dev\Scratch\aurelia-routing-with-backend> au new --here              
Global aurelia-cli v2.0.2
makes v2.1.1 https://makes.js.org
[makes] Using remote skeleton github:aurelia/v1
[makes] Fetching tarball https://codeload.github.com/aurelia/v1/tar.gz/master

         #
      ######   xxx
     ########  xxxx   ####         _                  _ _
   x   ########    ########       / \  _   _ _ __ ___| (_) __ _
     x  ######  #############    / _ \| | | | '__/ _ \ | |/ _` |
  xxxxx  ##  ###############    / ___ \ |_| | | |  __/ | | (_| |
   xxxxx  ###############      /_/   \_\__,_|_|  \___|_|_|\__,_|
    x ###############  xxx
    ##############  #   xx
 ##############  ######         https://aurelia.io
  ########## x  ########        https://github.com/aurelia
    #####  xxxx   ########      https://twitter.com/aureliaeffect
     #   x  x      ######
                     #

@3cp
Copy link
Member

3cp commented Nov 18, 2020

Sounds like you have a trapped local makes v2.0.1 somewhere.
First make sure it's not installed globally, npm uninstall -g makes.

Then in the folder where it didn't work, use node command to go into REPL mode of nodejs. In console, try

require.resolve("makes");

That will tell you where the "makes" is installed. I am guessing somewhere in a parent_folder/node_modules. You can remove that parent_folder/node_modules if it's created by an accidental npm i xxx (accidentally missed out -g) in that folder.

@davidsk
Copy link
Author

davidsk commented Nov 19, 2020

I've removed the makes package and tried to identify the 'trapped' makes package but it's doesn't appear to be there...

C:\Dev\Scratch\aurelia-routing-with-backend> node
Welcome to Node.js v15.0.1.       
Type ".help" for more information.
> require.resolve("makes");
Uncaught Error: Cannot find module 'makes'
Require stack:
- <repl>
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
    at Function.resolve (node:internal/modules/cjs/helpers:94:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '<repl>' ]
}

...and npx reports it's still using version 2.0.1...

C:\Dev\Scratch\aurelia-routing-with-backend> npx au new --here
Global aurelia-cli v2.0.2
makes v2.0.1 https://makes.js.org
Cannot find git repo aurelia\v1
npm ERR! code 1
npm ERR! path C:\Dev\Scratch\aurelia-routing-with-backend
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c ""makes" "aurelia\v1" "--here""

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\keith\AppData\Local\npm-cache\_logs\2020-11-19T20_44_20_564Z-debug.log
C:\Dev\Scratch\aurelia-routing-with-backend> 

🤷‍♂️

@3cp
Copy link
Member

3cp commented Nov 20, 2020

I have no idea why and where it kept the old v2.0.1, my au new doesn't have the problem.

Maybe try resetting all npm caches npm cache clear --force.

Do you use or your company use an internal npm server like https://verdaccio.org?

@3cp
Copy link
Member

3cp commented Nov 20, 2020

It looks like your makes is not fetched from remote

C:\Dev\Scratch\aurelia-routing-with-backend> npx au new --here
Global aurelia-cli v2.0.2
makes v2.0.1 https://makes.js.org

My log shows extra line npx: installed 1 in 1.xxxs.

⋊> ~/playground npx au new --here
Global aurelia-cli v2.0.2
npx: installed 1 in 1.434s
makes v2.1.1 https://makes.js.org

@davidsk
Copy link
Author

davidsk commented Nov 20, 2020

Nope, this is personal dev stuff, no company shenanigans.

I ran npx makes@2.1.1 aurelia/v1 and it worked as expected but it did prompt me to confirm "download(ing) 1 package". Works again if I run it a second time but this time without the prompt. require.resolve("makes") shows nothing either but it does look like there's a secret local cache somewhere.

Cleared my npm cache as you suggested but au new still fails though 😢

@3cp
Copy link
Member

3cp commented Nov 21, 2020

Just noticed you are on npm 7 with node 15. That might be the cause. I will try that version.

@3cp
Copy link
Member

3cp commented Nov 21, 2020

Yes, npx in npm 7 definitely changed behaviour, it now install the package somewhere. The somewhere must be the hidden cache in your case.

⋊> ~/playground npx makes aurelia/v1                                                                                                                                                                21:18:07
Need to install the following packages:
  makes
Ok to proceed? (y) 

@3cp
Copy link
Member

3cp commented Nov 21, 2020

npm/cli#1935

@3cp
Copy link
Member

3cp commented Dec 23, 2020

From the linked npm issue, the cached location for your local npx commands is your local .npm/_npx folder.
For windows, it's C:\Users\_username_\AppData\Roaming\npm-cache\_npx.

You can clean up the folder to force npx to download the latest version.

@3cp
Copy link
Member

3cp commented Feb 6, 2021

npm v7.5.2 is released with fix of the npx ignoring latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants