Closed sg-chrishasz closed 6 years ago
Hi Chris,
TBH I don't understand the issue clearly. When you add spsave as dependency, npm install spsave --save
, you see above errors? I tried to do that and didn't receive any errors.
Also I've tried to clone spgo, run npm install
, then npm install spsave --save-prod
, npm said that "notice save spsave is being moved from devDependencies to dependencies" - without issues.
Have you tried deleting node_modules and do the same steps as I did?
Hi Chris,
Did you try deliting node_modules/folder, probably package-lock.json too, and reinstalling?
I have latest spsave as a dependency, packaged in one of the libraries, just updated it yesterday, and it worked too. Yet, in my case I use yarn.
Ooops had issues sending message from the phone, while was sending there was comment from Sergei. :)
Offtopic Can't believe that:
No worries, I’m a time traveler who came back for a second before your response. :)))
UPD: I have a punch for a not asked question. "It took GitHub API 2 seconds to post those commend of mine."
Hello Everyone!
Yes, I see the errors when i add SPSave as a dependency to SPGo using npm install
, then npm install spsave --save
or npm install spsave --save-prod
. Can you try the following repro steps and let me know what you see?
Download SPGo, from 1.2.2 branch.
git clone https://github.com/readysitego/spgo
git checkout 1.2.2
git pull
Build Project
npm install
npm install spsave --save-prod
(optional)
vsce package
(you may need npm install -g vsce
if the VSCode command line is not installed)
You can also replicate the issue, after npm install
by using the following command
npm list --production --parseable --depth=9999
You should the the errors output in my original issue report. I have found that i can successfully package SPGo if I install spsave as a dev dependencay, but then it the .visx package does not contain spsave, which is the issue with the current build on the marketplace.
It is quite possible this is an NPM issue, or something related to how packages are resolving generally, but I am only seeing these messages for spsave.
Feel free to reach out directly (chris@sitego.co) if you have specific questions. Thanks for your support! -Chris
Now I see the issue... will take a look.
So... it looks really bad. For some reason npm doesn't dedupe dependencies automatically for spsave (and only for spsave). Meaning that if you do npm install spsave
in empty folder, it generates below folder structure:
node_modules -> spsave -> node_modules -> [a lot of folders]
instead should be: node_modules -> [a lot of folders, including spsave folder]
The issue is valid for npm 5.6.0 and it looks like for 5.5.1 as well. I found the issue in npm - npm install doesn't flatten (dedupe) all (transitive) dependencies, however not sure how to move forward.
@sg-chrishasz finally resolved in 3.1.4 with help of @koltyakov :)
Thank you both for your help here! I've published an updated build of SPGo and all appears well.
Glad to hear! It appeared that npm-shrinkwrap.json caused the issue, which "locks" dependencies under spsave/node_modules. I've added it to .npmignore file, so in future you shouldn't see such kind of errors anymore.
Hello @s-KaiNet
Since SPGo 1.2.0, I've been using SPSave 3.1.2. It appears that there has been a change in how packages and types are linked in this version and it is now recommended to be installed as a dev dependency (
npm install spsave --save-dev
). Unfortunately, for SPGo that prevents spsave from being included in the production package that is deployed to the VSCode marketplace. If i try to install the package as a prod depenency (either vianpm install
or with the--save-prod
flag) packaging will fail with a number of npm errors.Is there a hard requirement to install spsave as a dev dependency, is there a way to install spsave without extraneous errors, or is this a PEBKAC error on my part and you have guidance you can provide on how to fix the errors below?
NPM Errors when installed or listed as a production dependency