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.
Successful installation.
Windows 10 Pro 18363.900
yarn v1.22.4
PowerShell 5.1.18362.752
Saw the same error, also using powershell (but npm 6.4.13 rather than yarn).
@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.
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
@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?
npx npm-force-resolutions || true
It works in my local Windows10!
@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
@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.
@lehni
How about using postshrinkwrap? https://github.com/paperjs/paper.js/commit/d3e5aabb019474188fe99128543e3b6d27be302d
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
https://github.com/rogeriochaves/npm-force-resolutions/issues/10#issuecomment-617750918
We can also remove package-lock.json, in this way.
@sapics great find! Let's go with that!
@sapics it doesn't seem to work yet, see https://travis-ci.org/github/paperjs/paper.js/builds/701801440
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
So why don't we use npx npm-force-resolutions || true in preinstall?
Oh, sorry... Now, I wake up :)
It looks running in
https://travis-ci.org/github/paperjs/paper.js/jobs/701801444#L459
but error in
https://travis-ci.org/github/paperjs/paper.js/jobs/701801444#L471
.
I guess npx npm-force-resolutions || true will work also.
But I afraid the error which you wrote in https://github.com/paperjs/paper.js/commit/30beb3af931a3ca431c53a1419ca17d86e7838c0.
Dose it mean
× npx npm-force-resolutions
â—‹ npx npm-force-resolutions || true
?
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.
@lehni It works when I merge PR #1836.
It's strange behavior, but could you try this version?
I have this issue with cmd and npm too.
This is still happening on:
Windows 10.0.18363
Powershell 5.1.18362.752
NPM version 6.14.5
This is still happening,
if you are installing paperjs on windows,
0.12.8 is the latest version that you can use.
Update your npm version and node. I had this problem, but after update everything is ok.
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
> [email protected] 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/[email protected] requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: `[[ $npm_config_heading == 'npm' ]] && npx npm-force-resolutions || true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 !]>
Switching from command prompt / PowerShell To Git Bash GUI Solved this for me.
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.
In WSL or git-bash GUI it works indeed, but in windows it still fails. Somewhat annoying while working in intellij, that IDE still does not have built-in wsl support. So if you execute a jest/mocha-test from the IDE, as a preparation, the npm install had to be executed in windows-cmd or powershell. I love to work in that IDE, because it's handy to run/debug a single test without typing the whole command manually...
A work-arround is downgrading paper to v0.12.8, but I don't like to stay quite long on an 'old' version
I upgraded to PowerShell Core 7.0.3, which I think should fix the || syntax. No luck though, install still crashes on the [[ bit
can someone rewrite that bit of shell with something compatible cross-platform?
(what was it before?)
> [email protected] preinstall E:\GitHub\artella\artella-ng-web\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.
@bboyle seeing the same here with this install. any resolution to this? its starting to ruin my day :(
@brent185 I also have this problem,Have you solved this problem,Please help me. tks!!
@brent185 I also have this problem,Have you solved this problem,Please help me. tks!!
You must install the 0.12.8 to make it works.
@m-valvano-zakeke I'm looking at a project on GitHub that uses the latest version. When I upgrade, I still report this error. What should I do to use the pre installed version
You should remove the newest version (npm remove paper) and install the correct one (npm install [email protected]).
I don't think there is any breaking change so your project should work.
@m-valvano-zakeke Yes, it works. But when I print paper, there is no default field under this object, which makes me confused
@m-valvano-zakeke Yes, it works. But when I print paper, there is no default field under this object, which makes me confused
What do you mean exactly? Can you send a screenshot?
@m-valvano-zakeke well.... I'm a rookie,I don't send screenshots.I mean, when I was looking at GitHub project, its paper version was 0.12.11 project. When I print paper, there will be a default value in the output object, but there is no output in my 0.12.8 version. cry..
If you installed it correctly and you import it correctly then you should have the correct object
Will this be fixed or are NPM users permanently stuck on 0.12.8?
@Welchen Releases for paper.js tend to be infrequent even when there are critical fixes to be released. I've been stuck on old versions of paper.js numerous times due to a critical bug, and this incident has continued that trend. However, I wouldn't give up hope of there never being another release, it will just get released whenever @lehni gets around to cutting another release.
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.
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.
@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 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.
@lehni I think that current develop version would work in Windows 10. Could you release a new version 0.12.12?
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.
@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 ;(
@lehni Thank you for your response while you are busy. I'm looking forward to your coming back!
I have the same issue.
I have the same issue too. Is there any follow-up/solution on this?
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).
Just to confirm: [email protected] does not install on Windows 10 using Powershell, cmd or git-bash.
I thought Git Bash works, but I'm not sure.
@stefanuddenberg , @kamiyubidan , @Methuselah96 : here is the smallest repo demonstrating the problem, and solution.
https://github.com/whyld4900/paperjs-powershell-issue
@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
Most helpful comment
Switching from command prompt / PowerShell To Git Bash GUI Solved this for me.