Skip to content

fix: error while installing [email protected] 'invalid or unexpect… #4807

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

Closed
wants to merge 2 commits into from

Conversation

alan-agius4
Copy link

@alan-agius4 alan-agius4 commented Nov 30, 2017

…ed token'

Closes: #4805

@vendethiel, @lydell & @GeoffreyBooth.

@Alevale
Copy link

Alevale commented Nov 30, 2017

This will actually show the message for anybody using coffeescript, no matter if using the "coffeescript" package or "coffee-script" so I would say it's not valid because what you want is to say that you need to change the name to "coffeescript" only if you are using "coffee-script" and not also if you are using it.

@alan-agius4
Copy link
Author

alan-agius4 commented Nov 30, 2017

@Alevale, the if statement is based on the "name" value in the package.json which in package.json is always coffee-script

https://github.com/jashkenas/coffeescript/blob/1/package.json#L2

Unless I am missing something

image

in the coffescript package there is no postinstall script
https://github.com/jashkenas/coffeescript/blob/master/package.json

@GeoffreyBooth
Copy link
Collaborator

I tested this in Windows by pasting the package.json into a folder and running npm run postinstall and it seems to work. It’s unfortunate that we lose the quotes around "coffee-script", as that was meant to imply that string in package.json, but I can live with that.

@alan-agius4 have you tested this in Windows?

@GeoffreyBooth
Copy link
Collaborator

Oh and I’ll just leave out the postinstall entirely in the coffeescript side. The if was meant so that there would be one consistent codebase between the two, but clearly it’s not worth the headache.

@alan-agius4
Copy link
Author

alan-agius4 commented Nov 30, 2017 via email

@GeoffreyBooth
Copy link
Collaborator

GeoffreyBooth commented Nov 30, 2017

Great, do you mind really and truly testing it via the steps in #4759 (comment)? I just don’t want to push more than one fix to this 😄 And I don’t have a great Windows environment to test with.

(Check out your branch rather than redirect as mentioned in the instructions.)

@alan-agius4
Copy link
Author

alan-agius4 commented Nov 30, 2017

Unfortunately i am at home nowand I only have mac available.

Basicly my test was the following;
npm pack (this created acts the same as npm publish but having the same pkg on disk rather than npm repo)

And

npm install

Anyone willing to test it out your way?

@GeoffreyBooth
Copy link
Collaborator

@alan-agius4 If there’s a way to have this only print on direct installs, we might as well add that ability at the same time as we fix this. I like your code in #4805 (comment), but it needs to be rewritten to run in Node 0.8+ (so no const etc.) and anything risky should go in a try block. We could put it into a warning.js and change postinstall to node ./warning.js. That should also fix the Windows quotes issue.

@alan-agius4
Copy link
Author

alan-agius4 commented Nov 30, 2017 via email

@GeoffreyBooth
Copy link
Collaborator

Yes, I don’t want to try again until Friday night Pacific time at the earliest.

@alan-agius4
Copy link
Author

alan-agius4 commented Dec 1, 2017

@GeoffreyBooth I pushed the implementation that we discussed yesterday, that said I had to do some modifications to the original snippet to get it working.

image

@alan-agius4 alan-agius4 force-pushed the patch-1 branch 3 times, most recently from b07587c to 258ca6f Compare December 1, 2017 13:40
warning.js Outdated
return;
}

var pgkData = readJsonFile(path.join(pgkCoffeeData._where, './package.json'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this?

Copy link
Author

@alan-agius4 alan-agius4 Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In npm when a package is installed the package.json is amended and some new fields are added one of these fields is _where which indicates from where the package was installed.

In case _where is not defined we cannot determine from where it was installed, thus show the warning.

warning.js Outdated
}

var hasOldCoffeScript = (pgkData.dependencies && pgkData.dependencies['coffee-script'])
|| (pgkData.devDependencies && pgkData.devDependencies['coffee-script']);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also there are some misspellings: hasOldCoffeeScript, pkgData.

…is listed under `dependencies` or `devDependencies`

Closes: jashkenas#4805
@GeoffreyBooth
Copy link
Collaborator

Let's pause on this, per #4714 (comment). I think we might just use npm deprecate instead after all.

@GeoffreyBooth
Copy link
Collaborator

Closing as @jashkenas will npm deprecate per #4714 (comment).

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

Successfully merging this pull request may close these issues.

3 participants