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

Unable to install v0.12.11 #1833

Closed
Methuselah96 opened this issue Jun 23, 2020 · 63 comments · Fixed by #1834
Closed

Unable to install v0.12.11 #1833

Methuselah96 opened this issue Jun 23, 2020 · 63 comments · Fixed by #1834

Comments

@Methuselah96
Copy link

Description/Steps to reproduce

On install of [email protected] I get this error message when trying to install with PowerShell on Windows:

Command: [[ $npm_config_heading == 'npm' ]] && npx npm-force-resolutions || true
Arguments:
Directory: C:\Users\Nathan\Documents\project\node_modules\paper
Output:
'[[' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.

Link to reproduction test-case

Expected result

Successful installation.

Additional information

Windows 10 Pro 18363.900
yarn v1.22.4
PowerShell 5.1.18362.752

@bboyle
Copy link

bboyle commented Jun 23, 2020

Saw the same error, also using powershell (but npm 6.4.13 rather than yarn).

@sapics
Copy link
Member

sapics commented Jun 23, 2020

@Methuselah96 @bboyle Thanks for the report!
It looks critical problem, I have confirmed with Windows10, nodejs v12.6.3, npm 6.14.4.
I will look into this.

@lehni
Copy link
Member

lehni commented Jun 23, 2020

Apologies for messing this one up. I actually noticed that this might happen with Yarn on Windows but wasn't aware of its widespread use… It didn't take long for this report to materialize :)

On Yarn we don't need to run this at all, which was the intent of that statement. But it looks like Windows can't handle these conditionals.

@sapics I don't think your fix is right, because on yarnwe don't need to run this at all (it supports resolutions natively).

So maybe this would work? npx npm-force-resolutions || true

@sapics
Copy link
Member

sapics commented Jun 23, 2020

@lehni

So maybe this would work? npx npm-force-resolutions || true

I guess it would work.

I have installed yarn by npm install -g yarn.
Is this the right way to check error in yarn?

@sapics
Copy link
Member

sapics commented Jun 23, 2020

npx npm-force-resolutions || true

It works in my local Windows10!

@lehni
Copy link
Member

lehni commented Jun 23, 2020

@sapics are you on Yarn 2 or 1? If version 2, could you also test 1? You can use the installer here: https://classic.yarnpkg.com/en/docs/install/#windows-stable

@sapics
Copy link
Member

sapics commented Jun 24, 2020

@lehni I use [email protected].
When I install nodejs with msi installer, npx is also installed automatically.
Thus, I guess that most of the nodejs installed users in Windows10 can use npx globally.

@sapics
Copy link
Member

sapics commented Jun 24, 2020

@lehni
How about using postshrinkwrap? d3e5aab
It works with "npm install" and "yarn" in Windows10.
In a bit of a look at the behavior, it seemed that postshrinkwrap wasn't running in yarn, so I expect that we'll get the desired result?

This method was introduced at npm-force-resolutions repository as
rogeriochaves/npm-force-resolutions#10 (comment)
We can also remove package-lock.json, in this way.

@lehni
Copy link
Member

lehni commented Jun 24, 2020

@sapics great find! Let's go with that!

@lehni
Copy link
Member

lehni commented Jun 24, 2020

@sapics it doesn't seem to work yet, see https://travis-ci.org/github/paperjs/paper.js/builds/701801440

@lehni lehni reopened this Jun 24, 2020
@lehni
Copy link
Member

lehni commented Jun 24, 2020

I think it simply doesn't get run at all now:

preshrinkwrap, shrinkwrap, postshrinkwrap: Run by the npm shrinkwrap command.
https://docs.npmjs.com/misc/scripts

@lehni
Copy link
Member

lehni commented Jun 24, 2020

So why don't we use npx npm-force-resolutions || true in preinstall?

@sapics
Copy link
Member

sapics commented Jun 24, 2020

@sapics
Copy link
Member

sapics commented Jun 24, 2020

I guess npx npm-force-resolutions || true will work also.
But I afraid the error which you wrote in 30beb3a.

Dose it mean
× npx npm-force-resolutions
npx npm-force-resolutions || true
?

@sapics
Copy link
Member

sapics commented Jun 24, 2020

I have fixed as npx npm-force-resolutions || true in #1836.
But there is still error as before, I am confusing... https://travis-ci.org/github/paperjs/paper.js/jobs/701810825
And it looks working in my travis https://travis-ci.org/github/sapics/paper.js/builds/701810697.

@sapics
Copy link
Member

sapics commented Jun 24, 2020

@lehni It works when I merge PR #1836.
It's strange behavior, but could you try this version?

@m-valvano-zakeke
Copy link

I have this issue with cmd and npm too.

@reubenromandy
Copy link

This is still happening on:
Windows 10.0.18363
Powershell 5.1.18362.752
NPM version 6.14.5

@wusatosi
Copy link

This is still happening,
if you are installing paperjs on windows,
0.12.8 is the latest version that you can use.

@lehni lehni self-assigned this Jul 28, 2020
@25Yevhenii01
Copy link

25Yevhenii01 commented Jul 29, 2020

Update your npm version and node. I had this problem, but after update everything is ok.

@bboyle
Copy link

bboyle commented Jul 30, 2020

still fails to install for me with '[[' is not recognized as an internal or external command,

I am using powershell. I don't think it likes that syntax.

node v14.6.0 and npm v6.14.7

E:\GitHub\repository [chore/dependencies]> npm i

> paper@0.12.11 preinstall E:\GitHub\repository\node_modules\paper
> [[ $npm_config_heading == 'npm' ]] && npx npm-force-resolutions || true

'[[' is not recognized as an internal or external command,
operable program or batch file.
'true' is not recognized as an internal or external command,
operable program or batch file.
npm WARN @ngneat/spectator@5.12.0 requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! paper@0.12.11 preinstall: `[[ $npm_config_heading == 'npm' ]] && npx npm-force-resolutions || true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the paper@0.12.11 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ben\AppData\Roaming\npm-cache\_logs\2020-07-30T07_13_10_838Z-debug.log
E:\GitHub\repository [chore/dependencies +0 ~1 -0 !]> node -v 
v14.6.0
E:\GitHub\repository [chore/dependencies +0 ~1 -0 !]> npm -v
6.14.7
E:\GitHub\repository [chore/dependencies +0 ~1 -0 !]> 

@wytboard-github
Copy link

Switching from command prompt / PowerShell To Git Bash GUI Solved this for me.

@whyld4900
Copy link

If you have bash.exe installed on your pc (installing git for windows puts it under Program Files) then you can set npm to use that for what it uses when running npm scripts. e.g.
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
Then you can add a npm script for yarn. e.g.
"y-install": "yarn install --force",
The 'force' is optional of couse.
Now you can run the npm command from powershell, e.g.
npm run y-install
or if you use VScode you can just "Run Script" directly in the packageJson.

@brent185
Copy link

Just an FYI for those that asked, i did try to get this working via npm and other methods, but the suggested approaches complicate our build/deploy processes, so I shelved it. I found that ClipperJS fulfills our requirement, so I likely wont be revisiting paper unless another need arises.

@whyld4900
Copy link

Will this be fixed or are NPM users permanently stuck on 0.12.8?

Is it possible for you to use bash to run you npm scripts?
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
Then when you run "npm run some-script" it will run on bash. And installing paperjs from bash works properly.

@Methuselah96
Copy link
Author

Methuselah96 commented Sep 15, 2020

@whyld4900 That workaround is simple for a single user, however is there a simple cross-environment way to do that where it would work for a team that is on Windows/Linux/MacOS and on CI through a project configuration setting? It seems simpler to just pin your version to v0.12.8 for now, unless there's something critical you need from v0.12.9.

@whyld4900
Copy link

@whyld4900 That workaround is simple for a single user, however is there a simple cross-environment way to do that where it would work for a team that is on Windows/Linux/MacOS and on CI through a project configuration setting? It seems simpler to just pin your version to v0.12.8 for now, unless there's something critical you need from v0.12.9.

The problem should only be for windows powershell or cmd, so most other users/build servers are using bash already. In our Azure pipeline the tests run on Linux (no issues) and we have a build for MacOS (no issues) and we have a windows build that has no issue either. Locally the windows devs have to use bash to run yarn install, but the windows cmd on the build server seems to work:
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\someGuid.cmd""
which kicks off "yarn install v1.22.4".
I tried that same cmd locally and it fails with usual error. Not sure why Azure cmd.exe yarn install doesn't fail too.

@sapics
Copy link
Member

sapics commented Sep 24, 2020

@lehni I think that current develop version would work in Windows 10. Could you release a new version 0.12.12?

@shishirraven
Copy link

Switching from command prompt / PowerShell To Git Bash GUI Solved this for me.

It worked also for me.
I opened Git Bash and it worked just fine. Previously I tried with prompt / powershell it had the same errors as above.

@lehni
Copy link
Member

lehni commented Oct 15, 2020

@sapics I'm so sorry for disappearing. I've been consistently swamped by work and life, trying to make some time for paper again soon ;(

@sapics
Copy link
Member

sapics commented Oct 15, 2020

@lehni Thank you for your response while you are busy. I'm looking forward to your coming back!

@edumorlom
Copy link

I have the same issue.

@bigmistqke
Copy link

I have the same issue too. Is there any follow-up/solution on this?

@stefanuddenberg
Copy link

Updating npm, running npm clean-install, using [email protected], and re-installing packages worked for me, even on powershell (although I should admit after doing all those other steps on git bash, because I was already mucking about with it).

@kamiyubidan
Copy link

Just to confirm: [email protected] does not install on Windows 10 using Powershell, cmd or git-bash.

@Methuselah96
Copy link
Author

I thought Git Bash works, but I'm not sure.

@whyld4900
Copy link

whyld4900 commented Nov 15, 2020

@stefanuddenberg , @kamiyubidan , @Methuselah96 : here is the smallest repo demonstrating the problem, and solution.
https://github.com/whyld4900/paperjs-powershell-issue

@kamiyubidan
Copy link

@whyld4900 Thanks. I tried it and it did install. For completeness though I'll post the error message I received probably due to my Windows user name having a space:

npm install paper

> [email protected] preinstall C:\Users\USER NAME\Documents\Code\JavaScript\projectname\electron\paperjs\experiment1\node_modules\paper
> [[ $npm_config_heading == 'npm' ]] && npx npm-force-resolutions || true

Error: EEXIST: file already exists, mkdir 'C:\Users\USER'
command not found: npm-force-resolutions
+ [email protected]
added 1 package from 2 contributors and audited 89 packages in 9.566s

@ayoub-root
Copy link

ayoub-root commented Dec 7, 2020

i have got the same problem, i solved it as mentioned above by using old version '0.12.8'

@414497934
Copy link

@ayoub-root yeah.I've tried this,but I want to use the latest version- _ -

@ievgennaida
Copy link

ievgennaida commented Jan 3, 2021

Same problem
P.s. thanks for the great project.
Downgraded to "paper": "0.12.8",

@davidxifeng
Copy link

use git bash on windows with yarn can be a workaround to fix this.

@ievgennaida
Copy link

@davidfeng thanks for the suggestion, but yarn is failing from time to time with some ESOCKETTIMEDOUT on windows so downgrade for a while is a better option in some cases :)

@MuTsunTsai
Copy link

Same problem here for Win 10.

@reinierpost
Copy link

reinierpost commented Feb 14, 2021

This is still broken in [email protected]. I'm on Ubuntu 18.04.

> [email protected] preinstall /home/rp/.nvm/versions/node/v14.15.4/lib/node_modules/squarefinder/node_modules/paper
> [[ $npm_config_heading == 'npm' ]] && npx npm-force-resolutions || true

sh: 1: [[: not found

No wonder: [[ ... ]] is a bashism, and on Ubuntu (and many other systems), sh is not bash.

@Dawied
Copy link

Dawied commented Feb 20, 2021

I thought Git Bash works, but I'm not sure.

Just tried with GitBash (after failing with PowerShell and cmd), it works.

lehni added a commit that referenced this issue Mar 12, 2021
Hopefully finally resolving #1833
@lehni
Copy link
Member

lehni commented Mar 12, 2021

I have just released v0.12.12 which should finally solve this problem. Could you all please check and report if this works for you? Apologies for taking so long to fix this.

@wusatosi
Copy link

I have just released v0.12.12 which should finally solve this problem. Could you all please check and report if this works for you? Apologies for taking so long to fix this.

I confirm it works on my windows terminal (both cmd and PowerShell) as I install paper.js 0.12.12!

@bboyle
Copy link

bboyle commented Mar 13, 2021

Also confirmed, thanks!! :)

@lehni
Copy link
Member

lehni commented Mar 13, 2021

Ok great! Closing this then. We can always reopen should there be persistent problems :)

@lehni lehni closed this as completed Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.